I’m running a VM instance (google compute engine) with CENTOS 7, everytime i run the bq command, i keep getting error. I supposed bq is by default in compute engine.
[username@instance-1 ~]$ bq
Error initializing bq client: service_account
Traceback (most recent call last):
File "/usr/lib64/google-cloud-sdk/platform/bq/third_party/pyglib/appcommands.py", line 805, in _CommandsStart
sys.modules['__main__'].main(GetCommandArgv())
File "/usr/lib64/google-cloud-sdk/platform/bq/bq.py", line 6078, in main
if FLAGS.debug_mode or FLAGS.headless:
File "/usr/lib64/google-cloud-sdk/platform/bq/third_party/absl/flags/_flagvalues.py", line 468, in __getattr__
raise AttributeError(name)
AttributeError: debug_mode
FATAL error in main: debug_mode
Run 'bq.py help' to get help
[username@instance-1 ~]$ bq --format=prettyjson dataset.tableid
FATAL Flags parsing error: Unknown command line flag 'use_gce_service_account'
Run 'bq.py help' to get help
[username@instance-1 ~]$
my compute engine account has full full access to all Cloud APIs, in addition just to be sure, i also add bigquery admin in the IAM part.
I’m not really sure what is wrong.
2
Answers
You might have a bash alias acting wrong or a
~/.bigqueryrc
Check the syntax and the correct service account files inside
~/.bigqueryrc
Have a look at the documentation:
and also in this section you can find flag that cause an error:
I’ve tried to run at my linux machine with Google Cloud SDK command
bq
and it works perfectly:At first, you should update your Cloud SDK to the latest version (or reinstall it) and check again. Also, please update your post with version of your Cloud SDK:
If you have en error with the latest Cloud SDK, try set up default values for
bq
in$HOME/.bigqueryrc
as it described in the documentation.In addition, I’d recommend you to check/update Python if nothing helps.
EDIT You can set up defaults in your
~/.bigqueryrc
file like this:in your favorite text editor like
nano
orvim
. Keep in mind that file paths in.bigqueryrc
had to be the full path.EDIT2 Have a look at the Cloud SDK system requirements:
and you have 2.7.5.
UPDATE Deleting and reinstalling the Cloud SDK solved the problem.