Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed May 30, 2024
1 parent dd56ed8 commit 2976c30
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tools/download-database.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def main():

export_DBML = True


class TableInserter:
def __init__(self, dbfile, jsondirectory):
self.db = sqlite3.connect(dbfile)
Expand Down Expand Up @@ -91,17 +92,14 @@ def insert_table(self, table_name, export_DBML):

if export_DBML:
if not len(scalar_columns) == 0:
print(f"Table {table_name.replace('-', '_')}" + "{") #DBML does not like dashes!
print(f"Table {table_name.replace('-', '_')}" + "{") # DBML does not like dashes!

for c in columns:
if not c.type.is_collection:
print(" " + c.name, c.type.sql_def)
print(" " + c.name, c.type.sql_def)

print("}")




table = SqlTableDef(table_name, scalar_columns, keycolumns)

cursor = self.db.cursor()
Expand Down Expand Up @@ -133,7 +131,8 @@ def insert_table(self, table_name, export_DBML):
cursor.execute(onetomanytable.create_statement)
except Exception as e:
if not export_DBML:
print(f'Dropping column {listcol.name} (running \'{onetomanytable.create_statement}\' leads to {e})')
print(f'Dropping column {listcol.name} (running \'{
onetomanytable.create_statement}\' leads to {e})')
continue

one_to_many_data = []
Expand Down

0 comments on commit 2976c30

Please sign in to comment.