1

I am trying to export a table from BigQuery to Google CLoud Storage (GCS) using bq command in a bat file. The command has a parameter to export as a Pipe delimited file. The command works from the CLI as it is but when I run from a bat file using the call command it opens the command but does not execute it. Note: Same operation runs without the pipe delimiter parameter.

Any idea why?

call bq extract -F^^^| my-project:my-dataset.mytable gs://myfolder/myfile.csv

This is the only line I have in my bat file. when I run from command line it works:

C:\bq extract -F^^^| my-project:my-dataset.mytable gs://myfolder/myfile.csv

Output:

Waiting on bqjob_r01419067_00000169eed1d868_1 ... (0s) Current status: DONE

When I run the bat file, C:\test.bat

Output:

C:\bq extract -F^| my-project:my-dataset.mytable gs://myfolder/myfile.csv C:\

michael_heath
  • 5,262
  • 2
  • 12
  • 22

1 Answers1

4

IF Jeb's solution is correct you should be able to change your batch file code to this.

set "caret=^"
call bq extract -F"%%CARET%%|" my-project:my-dataset.mytable gs://myfolder/myfile.csv
Squashman
  • 13,649
  • 5
  • 27
  • 36