Kyaw Tun
Kyaw Tun

Reputation: 13131

Google Cloud SDK update cause error for bq

After updating Google Cloud SDK 189.0.0, previously fine command bq query --nouse_legacy_sql " ... " now error as follow:

$ 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. $

Restoring previous version work again.

$ 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

Upvotes: 5

Views: 1437

Answers (2)

Daria
Daria

Reputation: 606

Try revoking and initializing your gcloud credentials:

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

or replace 'login' with the command you used to authenticate, if it was different.

Upvotes: 7

Ronoaldo Pereira
Ronoaldo Pereira

Reputation: 667

If your previous state was a good one, you can revert the upgrade to 189.0.0 by executing:

gcloud components restore

Doing this reverted my SDK back to 172.0.1 and bq to 2.0.26 both which I could execute from the VM again.

$ 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 |
+--------+

Upvotes: 1

Related Questions