How to add gcloud configuration so bq default is use_legacy_sql=false?

393 Views Asked by At

I'm lost in the Google documentation now and there must be some core trick I'm missing.

The bq command line tool defaults to use Legacy SQL which can be turned off for many commands by adding the parameter --use_legacy_sql=false. I want this to be the default so statements are interpreted as Standard SQL.

How do I configure this and other defaults for the bq command?

1

There are 1 best solutions below

0
On

As per the link provided by @DazWilkin (thank you), the solution is to create a ~/.bigqueryrc file containing at least the following:

[query]
--use_legacy_sql=false

This is a command-specific configuration default (e.g. for bq query) but global options can be added at the top before any [section] has been specified. More details at https://cloud.google.com/bigquery/docs/bq-command-line-tool#setting_default_values_for_command-line_flags