If you want to execute queries from the Google Cloud BigQuery web UI, two options are available:

  • BigQuery Editor
  • Cloud Shell console

I’ve found an issue when your project ID includes hyphen such as “shaped-glazing-741658”.

Here is an example to make it clear.

The following query I can execute without any issue from the Query Editor:

SELECT * FROM `bigquery-public-data.usa_names.usa_1910_current` LIMIT 10

If I try to execute the same query from the Cloud Shell console, I’m getting the following error:

account_name@cloudshell:~ (shaped-glazing-751458)$ bq query 'SELECT * FROM `bigquery-public-data:usa_names.usa_1910_current` LIMIT 10'
BigQuery error in query operation: Error processing job 'shaped-glazing-751458:bqjob_r55ccf37ba12cfea6_0000016b30c053c5_1': Invalid table name: `bigquery-public-data:usa_names.usa_1910_current`
[Try using standard SQL (https://cloud.google.com/bigquery/docs/reference/standard-sql/enabling-standard-sql)].

To resolve this issue, I need to use square brackets like this one:

bq query 'SELECT * FROM [bigquery-public-data:usa_names.usa_1910_current] LIMIT 10'


I hope Google will align its BigQuery engine interfaces to use the same syntax in one of the future releases.

Till then, I hope this will help you to spare some time trying to find correct syntax.

Get notified when a new post is published!



There are no comments yet. Why not start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.