Skip to content

Commit

Permalink
bigquery: use table.table_id instead of table.table_ref
Browse files Browse the repository at this point in the history
  • Loading branch information
cgsheeh committed Nov 1, 2024
1 parent 67ef322 commit cb50406
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_ref.table_id: bq_client.create_table(
staging_table_id(table.table_ref.table_id),
table.table_id: bq_client.create_table(
staging_table_id(table.table_id),
schema=table.schema,
exists_ok=True,
)
Expand Down Expand Up @@ -561,11 +561,11 @@ def submit_to_bigquery(

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

Expand Down Expand Up @@ -679,7 +679,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_ref.table_id
staging_table_id = staging_tables[target_table_id].table_id
merge_into_bigquery(
bq_client,
target_table_id,
Expand Down

0 comments on commit cb50406

Please sign in to comment.