BigQuery error · Permissions and access
Billing has not been enabled for this project
The project runs in the BigQuery sandbox (no billing account), and you used a feature the sandbox doesn't offer: here DML (INSERT, UPDATE, DELETE, MERGE). Link a billing account to the project, then remove the 60-day expirations the sandbox put on your datasets and tables.
The error message
Billing has not been enabled for this project. Enable billing at https://console.cloud.google.com/billing. DML queries are not allowed in the free tier. Set up a billing account to remove this restriction.
Causes
DML in a sandbox project
The sandbox lets you query and create tables at no cost, but doesn't support DML statements, streaming data or the BigQuery Data Transfer Service (which also runs scheduled queries). Any of them returns billingNotEnabled.
Other details after the same prefix
The first two sentences are fixed; the rest depends on the operation. Streaming reports Streaming insert is not allowed in the free tier, and setting a table expiration beyond the sandbox limit reports expiration time must be less than 60 days.
Billing was just linked
Billing changes can take some time to reach BigQuery. Users report the error persisting briefly after linking an account; retry after a few minutes.
How to fix it
1. Link a billing account to the project
In the Google Cloud console, open Billing and link an active billing account to the project. The free tier still applies afterwards (1 TiB of queries and 10 GiB of storage per month); usage above it is charged at the rates on the pricing page.
2. Remove sandbox expirations so data isn't deleted
Sandbox tables, views and partitions expire after 60 days, and upgrading doesn't change existing settings. Clear the dataset default and the expiration on each table you want to keep.
ALTER SCHEMA `my-project.analytics`
SET OPTIONS (
default_table_expiration_days = NULL,
default_partition_expiration_days = NULL
);
ALTER TABLE `my-project.analytics.orders`
SET OPTIONS (expiration_timestamp = NULL);3. Stay in the sandbox: rewrite DML as table creation
If you only need a modified copy, build a new table from a query instead of updating in place. Queries and DDL work in the sandbox within its limits.
CREATE OR REPLACE TABLE `my-project.analytics.orders_clean` AS
SELECT * REPLACE (LOWER(TRIM(email)) AS email)
FROM `my-project.analytics.orders`
WHERE status != 'test';How to prevent it
- Create a budget with alerts on the billing account at the same time you enable it.
- Set a custom daily query quota on new projects so the jump from sandbox to paid usage has a ceiling.
- Check dataset and partition expirations right after upgrading: forgotten sandbox defaults delete tables after 60 days.
FAQ
Will I be charged as soon as I enable billing?
Only for usage above the free tier. The first 1 TiB of query processing and 10 GiB of storage each month stay free on billed projects.
Can I run DML in the sandbox at all?
No. DML statements are not supported in the sandbox. Use CREATE OR REPLACE TABLE ... AS SELECT to produce a changed copy, or enable billing.
Is this an IAM permission problem?
No. It returns HTTP 403 like permission errors, but its reason is billingNotEnabled, and no role grant fixes it. Only linking a billing account does.
Related
SQL reference
More permissions and access
All BigQuery error messages · What 50M daily events say about BigQuery failures
