Skip to content

Commit

Permalink
optimization: only fetch bigquery schemas once per run in sync_bigque…
Browse files Browse the repository at this point in the history
…ry_release_files (#17451)
  • Loading branch information
ewdurbin authored Jan 18, 2025
1 parent 2c64e63 commit cd4cd65
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion warehouse/packaging/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,13 +375,17 @@ def sync_bigquery_release_files(request):
request.tm.commit()
request.tm.begin()

table_schemas = {
table_name: bq.get_table(table_name).schema for table_name in table_names
}

for missing_file in missing_files:
# Add the objects back into the new session
request.db.add(missing_file)
release_file = missing_file.file

for table_name in table_names:
table_schema = bq.get_table(table_name).schema
table_schema = table_schemas[table_name]

# Using the schema to populate the data allows us to automatically
# set the values to their respective fields rather than assigning
Expand Down

0 comments on commit cd4cd65

Please sign in to comment.