Most BigQuery tutorials jump straight to querying. But every warehouse starts with getting data in, and batch loading from Cloud Storage remains the simplest, cheapest path: load jobs are free to run (you pay for storage, and for the Cloud Storage side), unlike streaming inserts. This guide covers the decisions that matter.
1. Pick the file format first
| Format | Schema | Nested data | Notes |
|---|---|---|---|
| Parquet | Embedded | Yes | Columnar, compact; best default |
| Avro | Embedded | Yes | Great for row-oriented exports and schema evolution |
| ORC | Embedded | Yes | Common from Hive/Hadoop sources |
| JSONL | Autodetect or explicit | Yes | Newline-delimited only |
| CSV | Autodetect or explicit | No | Fragile: quoting, delimiters, type guessing |
If you control the producer, choose Parquet or Avro. Types survive the trip, and you avoid the classic CSV problems of embedded newlines and dates parsed as strings.
2. Load with SQL
LOAD DATA INTO analytics.orders
FROM FILES (
format = 'PARQUET',
uris = ['gs://my-bucket/orders/2026-01-15/*.parquet']
);
LOAD DATA INTO appends. Use LOAD DATA OVERWRITE to replace a table's contents. The same load can be run with bq load or the client libraries.
3. Load into a partitioned, clustered table
Create the destination table with partitioning first, so loads land in the right partitions and later queries prune:
CREATE TABLE IF NOT EXISTS analytics.orders (
order_id STRING,
customer_id STRING,
order_ts TIMESTAMP,
amount NUMERIC
)
PARTITION BY DATE(order_ts)
CLUSTER BY customer_id;
Then load as above. Rows are routed by order_ts automatically.
4. Make reruns idempotent
Schedulers retry. A blind append on retry duplicates data. Two safe patterns:
- Load to a staging table, then MERGE. Load the day's files into
analytics.orders_stg(usingLOAD DATA OVERWRITE), then:
MERGE analytics.orders AS t
USING analytics.orders_stg AS s
ON t.order_id = s.order_id
WHEN MATCHED THEN UPDATE SET
customer_id = s.customer_id, order_ts = s.order_ts, amount = s.amount
WHEN NOT MATCHED THEN INSERT ROW;
- Overwrite a whole partition. If each file set maps to exactly one day, load into the partition decorator (
analytics.orders$20260115) with overwrite semantics so a rerun replaces that day rather than adding to it.
Also keep a record of which files were loaded; loading the same URI twice is not deduplicated for you.
5. Handle schema changes deliberately
Schema drift is the usual cause of failed loads. Options:
- Allow field addition:
bq load --schema_update_option=ALLOW_FIELD_ADDITIONlets new columns appear.ALLOW_FIELD_RELAXATIONlets REQUIRED columns become NULLABLE. - Self-describing formats: Parquet and Avro carry their schema, so additions are far easier to detect than in CSV.
- Land raw, then transform: load into a raw table with permissive types, and cast in a downstream view or Dataform model. Failures then happen in SQL you can fix and rerun, not in ingestion.
Avoid schema autodetect for production CSV: it samples rows, so a column that is blank in the sample may be mistyped.
6. Tolerate a few bad rows, but not silently
For CSV and JSON, max_bad_records lets a load succeed despite a few malformed rows. Use it sparingly, and always check the job's error results afterward so bad rows are alerted on, not lost.
7. Inspect load jobs
SELECT job_id, creation_time, destination_table.table_id,
state, error_result.message AS error_message,
total_bytes_processed
FROM `region-us`.INFORMATION_SCHEMA.JOBS_BY_PROJECT
WHERE job_type = 'LOAD'
AND creation_time > TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 DAY)
ORDER BY creation_time DESC;
Adjust region-us to your location. Wire failed loads into alerting.
8. When not to batch load
- Need seconds-level freshness: use the Storage Write API.
- Need database replication: use Datastream CDC.
- Data rarely queried or owned elsewhere: consider external or BigLake tables instead of copying.
- Recurring SaaS or cloud-storage imports: the BigQuery Data Transfer Service schedules them without custom code.
Checklist
- Prefer Parquet or Avro over CSV
- Partition and cluster the destination before loading
- Stage then MERGE, or overwrite partitions, for safe retries
- Decide your schema-change policy up front
- Monitor load jobs through INFORMATION_SCHEMA
Need help designing ingestion for a migration or a new warehouse? Our BigQuery data engineers build and operate these pipelines. Get in touch through our contact page.