Reputation: 4382
BigQuery returns 400 Bad Request if dataset is not created and a query references it.
{
"code" : 400,
"errors" : [ {
"domain" : "global",
"location" : "query",
"locationType" : "other",
"message" : "Error preparing subsidiary query: Dataset deft-virtue-628:account_875 not found",
"reason" : "invalidQuery"
} ],
"message" : "Error preparing subsidiary query: Dataset deft-virtue-628:account_875 not found"
}
Ideally it should return 404 Not found, since the Dataset is not created. Is there a way to change this behavior.
UPDATE:
400 Bad Request is returned only in case of very complex queries where dataset/table is missing in inner queries/queries containing table wildcards.
For queries like this "SELECT * FROM [no_dataset.no_table]"
404 Not Found is returned.
The below query returns a 400 Bad Request
SELECT * FROM (TABLE_QUERY(dataset_exists, 'table_id CONTAINS "not_exist"'))
Upvotes: 1
Views: 1273
Reputation: 2057
A 404/notFound error should be returned when referencing a table that does not exist in a query.
Note that this is the case for most queries today. For example the query select a from doesNotExist.doesNotExist
returns a 404/notFound for the table "doesNotExist.doesNotExist". However I do see some cases with more advanced query features that conflate this error with 400/invalidQuery.
I've logged a issue on our internal tracker to resolve this. Thanks for the bug report!
Upvotes: 1