Skip to content

Commit

Permalink
bigquery: use full_table_id instead of table_id
Browse files Browse the repository at this point in the history
  • Loading branch information
cgsheeh committed Nov 1, 2024
1 parent d4d4c68 commit 4331bae
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,8 @@ def create_staging_tables(
staging table.
"""
return {
table.table_id: bq_client.create_table(
bigquery.Table(staging_table_id(table.table_id), schema=table.schema),
table.full_table_id: bq_client.create_table(
bigquery.Table(staging_table_id(table.full_table_id), schema=table.schema),
exists_ok=True,
)
for table in tables.values()
Expand Down Expand Up @@ -560,11 +560,11 @@ def submit_to_bigquery(

# Insert rows into staging table.
for chunk in chunked(rows, 500):
errors = bq_client.insert_rows_json(table.table_id, chunk)
errors = bq_client.insert_rows_json(table.full_table_id, chunk)
if errors:
logging.error(
"Encountered errors while inserting rows to "
f"{table.table_id}: {errors}."
f"{table.full_table_id}: {errors}."
)
sys.exit(1)

Expand Down Expand Up @@ -678,7 +678,7 @@ def process():
(BQ_REVIEW_REQUESTS_TABLE_ID, "review_id"),
(BQ_COMMENTS_TABLE_ID, "comment_id"),
):
staging_table_id = staging_tables[target_table_id].table_id
staging_table_id = staging_tables[target_table_id].full_table_id
merge_into_bigquery(
bq_client,
target_table_id,
Expand Down

0 comments on commit 4331bae

Please sign in to comment.