google bigquery - Error when trying to run a query via bq cli -
i'm getting following error when trying execute bq query:
fatal flags parsing error: unknown command line flag '-v'
the query simple , think problem inside concat function, because i'm trying concat curl command , there have -v flag, query below:
select concat('curl -v https://api.com.br/push.json -h \"content-type: application/json\" -h \"x_application: webapp\" -h -x post -d \'{\"pushes\":[\'' ,string_agg(to_json_string(t)),']}\'') json
how can escape -v not getting error?
thanks
try running this:
bq query "select concat('curl -v https://api.com.br/push.json -h \"content-type: application/json\" -h \"x_application: webapp\" -h -x post -d \'{\"pushes\":[\'',string_agg(to_json_string(t)),']}\'') json"
in order prevent bash interpretation string, maybe reading query file might well. if query like:
with data as( select [1, 2] t ) select concat('curl -v https://api.com.br/push.json -h \"content-type: application/json\" -h \"x_application: webapp\" -h -x post -d \'{\"pushes\":[\'',string_agg(to_json_string(t)),']}\'') json data
you save instance in file "query.sql" , run command:
cat query.sql | bq query --use_legacy_sql=false
Comments
Post a Comment