Skip to content

Commit cd4cd65

Browse files
authored
optimization: only fetch bigquery schemas once per run in sync_bigquery_release_files (pypi#17451)
1 parent 2c64e63 commit cd4cd65

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

warehouse/packaging/tasks.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,13 +375,17 @@ def sync_bigquery_release_files(request):
375375
request.tm.commit()
376376
request.tm.begin()
377377

378+
table_schemas = {
379+
table_name: bq.get_table(table_name).schema for table_name in table_names
380+
}
381+
378382
for missing_file in missing_files:
379383
# Add the objects back into the new session
380384
request.db.add(missing_file)
381385
release_file = missing_file.file
382386

383387
for table_name in table_names:
384-
table_schema = bq.get_table(table_name).schema
388+
table_schema = table_schemas[table_name]
385389

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

0 commit comments

Comments
 (0)