Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚚 Make download script error and continue #5411

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading