user1909643
user1909643

Reputation: 31

BigQuery console api "Cannot start a job without a project id"

I can call a sql on big query browser tool and I installed the bq tool on centos and register it now I can able connect bigdata and show the dataset or get the table data with head method but when i call the quert from bq tool I got "BigQuery error in query operation: Cannot start a job without a project id." I searched it on google but nothing found helpful.

Does anyone run a select query via "This is BigQuery CLI v2.0.1"

BigQuery> ls

   projectId     friendlyName  
 -------------- -------------- 
  XXXX   

API Project

BigQuery> show publicdata:samples.shakespeare   
Table publicdata:samples.shakespeare


   Last modified                  Schema                 Total Rows   Total Bytes   Expiration  
 ----------------- ------------------------------------ ------------ ------------- ------------ 
  02 May 02:47:25   |- word: string (required)           164656       6432064                   
                    |- word_count: integer (required)                                           
                    |- corpus: string (required)                                                
                    |- corpus_date: integer (required)   

BigQuery> query "SELECT  title FROM [publicdata:samples.wikipedia] LIMIT 10 "
BigQuery error in query operation: Cannot start a job without a project id.

Upvotes: 3

Views: 4379

Answers (1)

Jordan Tigani
Jordan Tigani

Reputation: 26617

In order to run a query, you need to provide a project id, which is the project that gets billed for the query (there is a free quota of 25GB/month, but we still need a project to attribute the usage to). You can specify a project either with the --project_id flag or by setting a default project by running gcloud config set project PROJECT_ID. See the docs for bq and especially the 'Working with projects' section here.

Also it sounds like you may have an old version of bq. The most recent can be downloaded here: https://cloud.google.com/sdk/docs/

Upvotes: 3

Related Questions