MCPcopy Index your code
hub / github.com/InstaPy/InstaPy / create_database

Function create_database

instapy/database_engine.py:72–103  ·  view source on GitHub ↗
(address, logger, name)

Source from the content-addressed store, hash-verified

70
71
72def create_database(address, logger, name):
73 try:
74 connection = sqlite3.connect(address)
75 with connection:
76 connection.row_factory = sqlite3.Row
77 cursor = connection.cursor()
78
79 create_tables(
80 cursor,
81 [
82 "profiles",
83 "recordActivity",
84 "followRestriction",
85 "shareWithPodsRestriction",
86 "commentRestriction",
87 "accountsProgress",
88 ],
89 )
90
91 connection.commit()
92
93 except Exception as exc:
94 logger.warning(
95 "Wah! Error occurred while getting a DB for '{}':\n\t{}".format(
96 name, str(exc).encode("utf-8")
97 )
98 )
99
100 finally:
101 if connection:
102 # close the open connection
103 connection.close()
104
105
106def create_tables(cursor, tables):

Callers 1

get_databaseFunction · 0.85

Calls 1

create_tablesFunction · 0.85

Tested by

no test coverage detected