Reputation: 463
I have a BQ script stored as a "Saved Query". I was wondering if I can execute it using the bq command-line utility. Could not find something relevant in the documentation.
Upvotes: 4
Views: 1142
Reputation: 1978
"Saved queries" are only accessible through the console and are not accessible through the API.
An approach that might suit you better would be to use Scripts and stored procedures.
In this way you define your SQL routine in a script myprocedure, and use "CALL mydataset.myprocedure()" to run it.
With bq it's then simply:
bq query --use_legacy_sql=false 'CALL mydataset.myprocedure()'
Upvotes: 3