Steve
Steve

Reputation: 159

Why is Big Query saying "Only SELECT statements are allowed in view queries" now

I have saved views in BigQuery that do updates, but today when I try and change one and save it I get this error "Only SELECT statements are allowed in view queries".

Tried in new and old GUI, get the same error, is this a feature added or a fault, I cannot find any documentation on the change?

UPDATE
  `myproject.MIS.tblData`
SET
  HQty = 117
WHERE
  ItemCode = '760815'
  AND PrimaryLocCode = '5642'

Expect it to save as its already saved but instead I get "Only SELECT statements are allowed in view queries" in the new GUI

and "Failed to save view. Only SELECT statements are allowed in view queries Dismiss" in the old GUI

Upvotes: 0

Views: 4931

Answers (1)

Elliott Brossard
Elliott Brossard

Reputation: 33705

There was a bug previously where the Save view button in the UI and executing a CREATE VIEW statement allowed different kinds of queries. Specifically, Save view allowed saving arbitrary queries as views, regardless of whether they were SELECT statements, and if you attempted to query them, you would receive a syntax error, which was confusing for many people. The BigQuery team corrected this oversight, and now you cannot save DML or DDL queries as views.

If you want to save an arbitrary query for future use, you can use the Save query feature instead. When you save a query, you can generate a link to share with others as well.

Upvotes: 2

Related Questions