in tooling/enrichment/consolidate_results.py [0:0]
def write_to_bigquery(df, table_name):
"""Write DataFrame to BigQuery table."""
client = bigquery.Client(project=PROJECT_ID)
table_id = f"{PROJECT_ID}.{DATASET}.{table_name}"
print(f"Writing {len(df)} rows to BigQuery table: {table_id}")
# Configure the job
job_config = bigquery.LoadJobConfig(
write_disposition="WRITE_TRUNCATE", # Overwrite the table if it exists
)
job = client.load_table_from_dataframe(
df, table_id, job_config=job_config
)
# Wait for the job to complete
job.result()
print(f"✓ Successfully wrote {len(df)} rows to {table_id}")