Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load a json file from biq query command line

Is it possible to load data from a json file (not just csv) using the Big Query command line tool? I am able to load a simple json file using the GUI, however, the command line is assuming a csv, and I don't see any documentation on how to specify json.

Here's the simple json file I'm using

{"col":"value"}

With schema col:STRING

like image 443
Jeremy McJunkin Avatar asked Jan 15 '23 11:01

Jeremy McJunkin


1 Answers

As of version 2.0.12, bq does allow uploading newline-delimited JSON files. This is an example command that does the job:

bq load --source_format NEWLINE_DELIMITED_JSON datasetName.tableName data.json schema.json

As mentioned above, "bq help load" will give you all of the details.

like image 100
Brian Beach Avatar answered Jan 18 '23 01:01

Brian Beach