计算引擎VM实例CENTOS7中的Bq命令行错误
Bq command line error in compute engine VM instance CENTOS7
我正在 运行使用 CENTOS 7 安装 VM 实例(google 计算引擎),每次我 运行 bq 命令时,我都会收到错误消息。我认为 bq 在计算引擎中是默认的。
[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 ~]$
我的计算引擎帐户拥有对所有 Cloud API 的完全访问权限,此外为了确保安全,我还在 IAM 部分添加了 bigquery admin。
我不太确定哪里出了问题。
您的 bash 别名可能有误或 ~/.bigqueryrc
检查 ~/.bigqueryrc
中的语法和正确的服务帐户文件
看看 documentation:
The bq authorization flags are deprecated. To configure authorization
for the bq command-line tool, see Authorizing Cloud SDK tools.
并且在本节中您还可以找到导致错误的标志:
--use_gce_service_account
我尝试在我的 linux 机器上 运行 使用 Google Cloud SDK 命令 bq
并且它完美运行:
$ bq
Python script for interacting with BigQuery.
USAGE: bq.py [--global_flags] <command> [--command_flags] [args]
Any of the following commands:
cancel, cp, extract, get-iam-policy, head, help, init, insert, load, ls, mk, mkdef, partition, query, rm, set-iam-policy, shell,
show, update, version, wait
首先,你应该update你的Cloud SDK到最新版本(或重新安装)并再次检查。另外,请使用您的 Cloud SDK 版本更新您的 post:
$ gcloud info
Google Cloud SDK [277.0.0]
Python Version: [3.7.5rc1 (default, Dec 20 2019, 17:52:56) [GCC 8.3.0]]
Python Location: [/usr/bin/python3]
如果您在使用最新的 Cloud SDK 时遇到错误,请尝试按照 documentation.
中所述在 $HOME/.bigqueryrc
中为 bq
设置默认值
此外,如果没有任何帮助,我建议您 check/update Python。
编辑 您可以像这样在 ~/.bigqueryrc
文件中设置默认值:
project_id = --my-project-id--
在您最喜欢的文本编辑器中,例如 nano
或 vim
。请记住,.bigqueryrc
中的文件路径必须是完整路径。
EDIT2 看看 Cloud SDK system requirements:
It requires Python 2.7.9 or higher.
你有 2.7.5。
更新 删除并重新安装 Cloud SDK 解决了问题。
我正在 运行使用 CENTOS 7 安装 VM 实例(google 计算引擎),每次我 运行 bq 命令时,我都会收到错误消息。我认为 bq 在计算引擎中是默认的。
[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 ~]$
我的计算引擎帐户拥有对所有 Cloud API 的完全访问权限,此外为了确保安全,我还在 IAM 部分添加了 bigquery admin。
我不太确定哪里出了问题。
您的 bash 别名可能有误或 ~/.bigqueryrc
检查 ~/.bigqueryrc
看看 documentation:
The bq authorization flags are deprecated. To configure authorization for the bq command-line tool, see Authorizing Cloud SDK tools.
并且在本节中您还可以找到导致错误的标志:
--use_gce_service_account
我尝试在我的 linux 机器上 运行 使用 Google Cloud SDK 命令 bq
并且它完美运行:
$ bq
Python script for interacting with BigQuery.
USAGE: bq.py [--global_flags] <command> [--command_flags] [args]
Any of the following commands:
cancel, cp, extract, get-iam-policy, head, help, init, insert, load, ls, mk, mkdef, partition, query, rm, set-iam-policy, shell,
show, update, version, wait
首先,你应该update你的Cloud SDK到最新版本(或重新安装)并再次检查。另外,请使用您的 Cloud SDK 版本更新您的 post:
$ gcloud info
Google Cloud SDK [277.0.0]
Python Version: [3.7.5rc1 (default, Dec 20 2019, 17:52:56) [GCC 8.3.0]]
Python Location: [/usr/bin/python3]
如果您在使用最新的 Cloud SDK 时遇到错误,请尝试按照 documentation.
中所述在$HOME/.bigqueryrc
中为 bq
设置默认值
此外,如果没有任何帮助,我建议您 check/update Python。
编辑 您可以像这样在 ~/.bigqueryrc
文件中设置默认值:
project_id = --my-project-id--
在您最喜欢的文本编辑器中,例如 nano
或 vim
。请记住,.bigqueryrc
中的文件路径必须是完整路径。
EDIT2 看看 Cloud SDK system requirements:
It requires Python 2.7.9 or higher.
你有 2.7.5。
更新 删除并重新安装 Cloud SDK 解决了问题。