Commit bug fix (#51)

This commit is contained in:
Mark Cheese 2020-03-19 14:41:24 -04:00 committed by GitHub
parent 03cd07af3b
commit 13d2a09b7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -47,6 +47,10 @@ def execute(input_file, output_file, extras=False) -> None:
build_sql_schema(json_data, output_file) build_sql_schema(json_data, output_file)
parse_and_import_cards(json_data, input_file, output_file) parse_and_import_cards(json_data, input_file, output_file)
parse_and_import_extras(input_file, output_file) parse_and_import_extras(input_file, output_file)
if output_file["path"].suffix == ".sql":
output_file["handle"].write("COMMIT;")
else:
output_file["handle"].commit()
output_file["handle"].close() output_file["handle"].close()
@ -396,11 +400,6 @@ def parse_and_import_cards(
) )
sql_dict_insert(set_translation_attr, "set_translations", output_file) sql_dict_insert(set_translation_attr, "set_translations", output_file)
if output_file["path"].suffix == ".sql":
output_file["handle"].write("COMMIT;")
else:
output_file["handle"].commit()
def parse_and_import_extras(input_file: pathlib.Path, output_file: Dict) -> None: def parse_and_import_extras(input_file: pathlib.Path, output_file: Dict) -> None:
""" """
@ -488,11 +487,6 @@ def parse_and_import_extras(input_file: pathlib.Path, output_file: Dict) -> None
output_file, output_file,
) )
if output_file["path"].suffix == ".sql":
output_file["handle"].write("COMMIT;")
else:
output_file["handle"].commit()
def sql_insert_all_card_fields( def sql_insert_all_card_fields(
card_attributes: Dict[str, Any], output_file: Dict card_attributes: Dict[str, Any], output_file: Dict