Search code examples
google-cloud-platformgoogle-bigquerycallprocedureinvoke

How can I call a BigQuery procedure from the bq command-line tools?


How can I invoke a BigQuery procedure from the bq command-line tools? I tried with the following forms, but it didn't work for me:

bq query 'call dataset.procedure();'
bq query 'call `project.dataset.procedure`();'

Is it true that the call keyword is not yet supported by the bq command-line client? Thanks.


Solution

  • You need to use #standardSQL:

    bq query "call temp.proc()"
    

    Gives the error:

    Error in query string: Error processing job 'fh:bqjob_r40': Encountered " "call "" at line 1, column 1. Was expecting: [Try using standard SQL (https://cloud.google.com/bigquery/docs/reference/standard-sql/enabling-standard-sql)]

    Follow that link, and you'll see that one way to fix this is:

    bq query --use_legacy_sql=false "call temp.proc()"