Bigquery command line tool to read a long query string from a file

I am using the Bigquery command line tool to query data from a Bigquery table.

My request instruction is very long.

Is there a way to save a long query in a file and pass the file name to the Bigquery command line tool?

Thanks.

+6
source share
2 answers

You can use this:

cat query.txt | bq query 
+4
source

Just use cat in labels. If necessary, switch double quotes to single quotes.

bq query "`cat query.txt`"

+3
source

Source: https://habr.com/ru/post/973198/


All Articles