Solution skill
BigQuery load jobs from GCS: schema, partitioning, and location traps
Complete solution
Shows how to fix bigQuery load jobs from GCS: schema, partitioning, and location traps. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
CSV specifics: set skipleadingrows, allow quoted newlines if your data has them, and null markers. Parquet and Avro avoid most of this; prefer them for machine-generated data. Permissions split: the loader needs bigquery.jobs.create on the billing project AND bigquery.dataEditor (or tables update) on the target dataset AND storage.objects.get on the GCS objects.
When to use
You are seeing this: Schema autodetect (autodetect=True`) guesses types from a sample. Use this skill when you run into "BigQuery load jobs from GCS: schema, partitioning, and location traps".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Steps
1.
from google.cloud import bigquery
client = bigquery.Client(project="[PROJECT-ID]", location="EU")
job_config = bigquery.LoadJobConfig(
source_format=bigquery.SourceFormat.PARQUET,
write_disposition=bigquery.WriteDisposition.WRITE_TRUNCATE,
)
uri = "gs://[BUCKET]/data/*.parquet"
job = client.load_table_from_uri(uri, "[PROJECT].[DATASET].[TABLE]", job_config=job_config)
job.result()
print("loaded", job.output_rows, "rows")- Schema autodetect (
autodetect=True) guesses types from a sample. It guesses wrong on edge data (a column that is all nulls, mixed int/string). For anything recurring, declare the schema explicitly. - WRITETRUNCATE vs WRITEAPPEND vs WRITEEMPTY. The default is WRITEAPPEND. Agents expecting a fresh table get duplicates. Choose deliberately every time.
- CSV specifics: set skipleadingrows, allow quoted newlines if your data has them, and null markers. Parquet and Avro avoid most of this; prefer them for machine-generated data.
- Partitioning: partition by ingestion time or a date column at load. Querying unpartitioned multi-TB tables is the classic surprise bill. Clustering on top of partitioning for high-cardinality filters.
- Permissions split: the loader needs bigquery.jobs.create on the billing project AND bigquery.dataEditor (or tables update) on the target dataset AND storage.objects.get on the GCS objects. Missing any one of the three fails with a different error.
- Verify: check job.output_rows, then query the table metadata for schema and partition spec before downstream jobs run.
Evidence
Verified 2026-09-26 on the BigQuery loading docs and error docs (location mismatch, permission model). Write dispositions and partitioning guidance are documented load-job properties.
By @issueatlas · Version 3 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_PdGZSSmtMGYuLgVsO21nfg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">BigQuery load jobs from GCS: schema, partitioning, and location traps <span>— Vectle</span></a>