5

When doing a query using SDK's CLI like this: bq query "select * from [project]:[dataset].[table]"

Response is: BigQuery error in query operation: Error processing job '[project-id]:[job_id]': The project [project_name] has not enabled BigQuery.

Also when trying calling the BQ API in an application (e.g. inside an Apache Beam job), the response is the same (with error-code: 400, reason: invalid)

The BQ API is enabled in my console and the dataset is present (removing the dataset results in a different error message)

This sounds really like a dumb question – but I asked this on the Cloud Platform's community Slack but no suggestions on this there either.

flowjow
  • 171
  • 1
  • 3
  • 14
  • Does it work when you query directly from the BigQuery Web UI? – Graham Polley Jan 03 '17 at 23:32
  • Are you 100% you've enabled the API in the console i.e. https://console.cloud.google.com/apis/api/bigquery-json.googleapis.com/overview?project=&duration=PT1H – Graham Polley Jan 04 '17 at 06:23
  • Haven't made queries through Web UI. Have made queries to the same target table through https://developers.google.com/apis-explorer/#p/bigquery/v2/bigquery.jobs.query successfully. Yes, it says API is enabled for the project. – flowjow Jan 04 '17 at 08:58
  • Can you test using the Web UI? – Graham Polley Jan 04 '17 at 09:00

4 Answers4

9
  • First, as mentioned in early comments and answers, ensure that you have enabled the BigQuery API.

  • If you still get the same error message, you are most likely using the project name where you should be using the project id.

    The project id is the project name followed by a number, and you should be able to find it using the Console.

  • If you are sure you have the API enabled and the id and the name sorted correctly, try checking the Google Cloud Status Dashboard for any ongoing BigQuery outages.

user513951
  • 12,445
  • 7
  • 65
  • 82
  • I had this problem and your solution worked. Can you explain why I need to use the project id rather than the project name. Whats the difference? – vivian May 12 '19 at 20:20
  • 2
    @vivian The project id is a globally-unique identifier that lets the system internally recognize and represent to itself the unique entity that is your project; the project name is a handy human-readable "nickname" that exists for the benefit of the human user, but is otherwise useless to the computer. Google made a user interface error here by making them too similar to each other and not highlighting the differences in their usage. – user513951 May 13 '19 at 17:55
  • Thank you! That's very helpful! – vivian May 15 '19 at 21:03
6

Double check that you have enabled the BigQuery API via the console.

https://console.cloud.google.com/apis/api/bigquery-json.googleapis.com/overview?project=<your-project-id>&duration=PT1H

Graham Polley
  • 14,393
  • 4
  • 44
  • 80
6

Had similar issue today. Tried to re-enable BigQuery API, and it works now. But most likely, the problem was on Google's side:

July 26, 2017 Google BigQuery reporting issues

user1438038
  • 5,821
  • 6
  • 60
  • 94
Anton Babkin
  • 595
  • 1
  • 8
  • 12
-2

Let's say your project name is "bq-project". So you created a dataset called "bq-dataset". There are a lot of tables "table1,table2,table3". So you need to retrieve table1 data. First, You can try this via big query web UI.

SELECT * from bq-project.bq-dataset.table1