How can I change the project in BigQuery
We were also facing the same issue, and tried the setting --project_id
param and default project using gcloud config set project
command, but no luck.
Then we created the .bigqueryrc
file and passed the path via --bigqueryrc
flag, it worked.
content of the .bigqueryrc file
--project_id=gcp_project_id
Example:
bq --bigqueryrc=/path_to_file/.bigqueryrc ls -j
https://cloud.google.com/bigquery/docs/bq-command-line-tool#setting_default_values_for_command-line_flags
You have two ways to do it:
- Specify
--project_id
global flag inbq
. Example:bq ls -j --project_id <PROJECT>
- Change default project by issuing
gcloud config set project <PROJECT>
The default project that bq
respected for me was stored in $HOME/.config/gcloud/configurations/config_default
(Linux)