Request a demo

BigQuery error · Query and syntax errors

Table must be qualified with a dataset

The query names a table without its dataset, and the job has no default dataset to resolve it. Write the table as dataset.table or project.dataset.table. Older BigQuery versions printed the same error as Table name "<table>" missing dataset while no default dataset is set in the request.

Error reason invalid · HTTP 400 · Checked against the Google Cloud docs in November 2026

The error message

Table "<table>" must be qualified with a dataset (e.g. dataset.table).

Causes

A table referenced by its bare name

SELECT order_id FROM orders fails with Table "orders" must be qualified with a dataset (e.g. dataset.table). The same applies to CREATE TABLE, INSERT, DELETE and every other statement that names a table. Many posts and older tools show the earlier wording: Table name "orders" missing dataset while no default dataset is set in the request.

SQL written for a database with a default schema

PostgreSQL, Snowflake and SQL Server resolve bare table names through a current schema or search path. In BigQuery a job only has one if the request sets a default dataset.

A tool or library that doesn't set the default dataset

The same SQL can work in a tool that sends a default dataset (for example a connector configured with a dataset) and fail in another one, or in a scheduled query, that doesn't.

How to fix it

1. Qualify the table name

Use dataset.table, or project.dataset.table when the data is in another project than the job. Put backticks around names with hyphens.

SELECT order_id, amount
FROM `analytics-prod.sales.orders`
WHERE order_date = '2026-11-22';

2. Set a default dataset for the job

Pass a default dataset with the job instead of editing every query: bq query --dataset_id=sales in bq, default_dataset in the Python client's QueryJobConfig, or defaultDataset in the API. In a multi-statement query, the @@dataset_id system variable sets it for later statements.

SET @@dataset_id = 'sales';

SELECT order_id, amount
FROM orders
WHERE order_date = '2026-11-22';

3. Use a CTE name if you meant one

If orders was meant to be a CTE, check that the WITH clause defines it with exactly that name and that it is in scope of this statement; CTEs don't carry over to the next statement of a script.

How to prevent it

  • Fully qualify tables in scheduled queries, views and dbt models so the result never depends on a client's default dataset.
  • Dry-run migrated SQL in CI; the error is found during analysis, for free.

FAQ

Is a query that fails with this error billed?

No. It fails while resolving names, before reading data, so nothing is billed on-demand and no slot time is used under editions.

Do I need the project ID in every table name?

No. dataset.table resolves in the project that runs the job. Add the project when the data lives in another project, which is common when a separate project pays for queries.

Why is the error reason invalid and not invalidQuery?

BigQuery reports this check with reason invalid (HTTP 400). If you filter failed jobs by reason in INFORMATION_SCHEMA.JOBS, include both values to catch all query errors.

SQL reference

More query and syntax errors

All BigQuery error messages · What 50M daily events say about BigQuery failures

Stop finding BigQuery failures in Slack threads

Masthead watches every BigQuery job, dbt model, Dataform action and Airflow task from audit logs, groups failures into incidents and shows which tables and dashboards are affected. No access to your data and no added BigQuery cost.