mirror of
https://github.com/correl/mtgsqlive.git
synced 2024-11-25 11:09:51 +00:00
Make fast (#11)
This commit is contained in:
parent
99d6c40d4c
commit
c3add103cd
1 changed files with 3 additions and 2 deletions
|
@ -32,7 +32,7 @@ def main() -> None:
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
# Build the SQLite database
|
# 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;")
|
sql_connection.execute("pragma journal_mode=wal;")
|
||||||
|
|
||||||
build_sql_schema(sql_connection)
|
build_sql_schema(sql_connection)
|
||||||
|
@ -218,6 +218,8 @@ def parse_and_import_cards(
|
||||||
token_attr = handle_token_row_insertion(token, set_code)
|
token_attr = handle_token_row_insertion(token, set_code)
|
||||||
sql_dict_insert(token_attr, "tokens", sql_connection)
|
sql_dict_insert(token_attr, "tokens", sql_connection)
|
||||||
|
|
||||||
|
sql_connection.commit()
|
||||||
|
|
||||||
|
|
||||||
def sql_insert_all_card_fields(
|
def sql_insert_all_card_fields(
|
||||||
card_attributes: Dict[str, Any], sql_connection: sqlite3.Connection
|
card_attributes: Dict[str, Any], sql_connection: sqlite3.Connection
|
||||||
|
@ -423,4 +425,3 @@ def sql_dict_insert(
|
||||||
placeholders = ":" + ", :".join(data.keys())
|
placeholders = ":" + ", :".join(data.keys())
|
||||||
query = "INSERT INTO " + table + " (%s) VALUES (%s)" % (columns, placeholders)
|
query = "INSERT INTO " + table + " (%s) VALUES (%s)" % (columns, placeholders)
|
||||||
cursor.execute(query, data)
|
cursor.execute(query, data)
|
||||||
sql_connection.commit()
|
|
||||||
|
|
Loading…
Reference in a new issue