Charles
Charles

Reputation: 590

Running batch queries using the bq command line tool

Seems like the flag --batch has no use when set within the bq query command:

bq query "SELECT name,count FROM mydataset.mytable WHERE myfield = 'condition' ORDER BY count DESC LIMIT 6" --batch

The command above runs the query straight away.

I'm running version 2.0.7 of BigQuery CLI.

Upvotes: 1

Views: 1549

Answers (1)

Michael Sheldon
Michael Sheldon

Reputation: 2057

The parser for command flags works like this:

bq [global flags] <command> [command flags] [command parameters]

Unfortunately the parser silently drops flags specified after the arguments, so it's not clear this is what happened to your command line.

To specify --batch, you would have to put it immediately after "query" like so:

bq query --batch "SELECT name,count FROM mydataset.mytable WHERE ..."

Since batch mode queries can take a long time, I suggest you run the query async like so:

bq --nosync query --batch "SELECT name,count FROM mydataset.mytable WHERE ..."

Upvotes: 3

Related Questions