Skip to content

Commit

Permalink
🚚 Make download script error and continue (#5411)
Browse files Browse the repository at this point in the history
The download script doesn't deal well with maps, but at least we can make it catch the error and continue.
  • Loading branch information
rix0rrr committed Apr 15, 2024
1 parent c54432f commit d7ff75d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tools/download-database.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,13 @@ def insert_table(self, table_name):
table.key_columns + [onetomanycol] if listcol.type.is_set else [])
print(onetomanytable.table_name)
cursor.execute(onetomanytable.drop_statement)
cursor.execute(onetomanytable.create_statement)
try:
# The `classes` table contains a list of objects, which this script can't
# deal with. Catch the error, but continue.
cursor.execute(onetomanytable.create_statement)
except Exception as e:
print(f'Dropping column {listcol.name} (running \'{onetomanytable.create_statement}\' leads to {e})')
continue

one_to_many_data = []
for row in table_data['rows']:
Expand All @@ -110,7 +116,7 @@ def insert_table(self, table_name):

# Maps (not implemented yet)
for mapcol in (col for col in columns if col.type.is_map):
print(f'Dropping column: {table.original_name}.{mapcol.original_name}')
print(f'Dropping column: {table.original_name}.{mapcol.original_name} (no support for map columns)')

self.db.commit()

Expand Down

0 comments on commit d7ff75d

Please sign in to comment.