Google Cloud SDK更新导致bq错误

时间:2018-02-18 05:55:03

标签: google-bigquery gcloud

更新Google Cloud SDK 189.0.0之后,以前的精确命令bq query --nouse_legacy_sql " ... "现在出现如下错误:

$ python --version Python 2.7.13 :: Anaconda, Inc. $ bq version This is BigQuery CLI 2.0.29 $ bq query --nouse_legacy_sql "SELECT country, model, iid, version, count(*) as n, max(t) AS t FROM an6.sm GROUP BY country, model, iid, version ORDER BY t DESC LIMIT 10 " bq.py should not be invoked. Use bq command instead. $

再次恢复以前的版本工作。

$ gcloud components restore
Your Cloud SDK installation will be restored to its previous state.

Do you want to continue (Y/n)?  Y

Restoring backup...

Performing post processing steps...done.
Restoration done!

$ bq query --nouse_legacy_sql "SELECT country, model, iid, version, count(*) as n, max(t) AS t FROM an6.sm GROUP BY country, model, iid, version ORDER BY t DESC LIMIT 10 "
Waiting on bqjob_r13976b38780fa35_00000161ab5076fe_1 ... (1s) Current 
status: DONE

2 个答案:

答案 0 :(得分:7)

尝试撤消并初始化您的gcloud凭据:

gcloud auth revoke <credentials you're using>
gcloud auth login

或使用您用于进行身份验证的命令替换“login”,如果它不同的话。

答案 1 :(得分:1)

如果您以前的状态良好,可以执行以下命令将升级恢复为189.0.0:

gcloud components restore

执行此操作将我的SDK恢复为172.0.1并将bq恢复为2.0.26,我可以再次从VM执行。

$ bq query "SELECT COUNT(word) FROM [bigquery-public-data:samples.shakespeare] LIMIT 1000" 
Waiting on bqjob_r1ac52f8ef09f41c2_00000161a981cfac_1 ... (0s) Current status: DONE   
+--------+
|  f0_   |
+--------+
| 164656 |
+--------+