Working with BigQuery using CLI

BigQuery can also be accessed and operated using the bq command. Here are some of the operations using the bq command in Cloud Shell:

  • To view a table in your database:
bq show projectId:datasetId.tableId
  • To run a certain query:
bq query "<<<query text>>>"  
  • To create a new table:
bq mk <<<dataset name>>>
  • To list the tables:
bq ls  
  • To load the dataset along with the schema:
bq load <<<dataset_name.filename schema_text>>> 
  • For example, to load the same babynames dataset as the GUI example:
bq load babynames.names2010 yob2010.txt name:string,gender:string,count:integer
  • Finally, to remove a dataset, use:
 bq rm -r <<<datasetID>>>
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset