Make fast (#11)

This commit is contained in:
Fryyyyy 2019-01-18 10:59:26 +11:00 committed by Zach H
parent 99d6c40d4c
commit c3add103cd

View file

@ -32,7 +32,7 @@ def main() -> None:
exit(1)
# Build the SQLite database
sql_connection = sqlite3.connect(output_file, isolation_level=None)
sql_connection = sqlite3.connect(output_file)
sql_connection.execute("pragma journal_mode=wal;")
build_sql_schema(sql_connection)
@ -218,6 +218,8 @@ def parse_and_import_cards(
token_attr = handle_token_row_insertion(token, set_code)
sql_dict_insert(token_attr, "tokens", sql_connection)
sql_connection.commit()
def sql_insert_all_card_fields(
card_attributes: Dict[str, Any], sql_connection: sqlite3.Connection
@ -423,4 +425,3 @@ def sql_dict_insert(
placeholders = ":" + ", :".join(data.keys())
query = "INSERT INTO " + table + " (%s) VALUES (%s)" % (columns, placeholders)
cursor.execute(query, data)
sql_connection.commit()