Database Reference
In-Depth Information
The bare command, without any arguments, lists datasets in the default
project. If specify a dataset name, it lists the tables in that dataset.
$ bq ls
datasetId
-----------
reference
$ bq ls reference
tableId
-----------
zip_codes
You can use the same command with the -j option to see the list of recent
jobs that have been run in a project.
$ bq --format=csv ls -j
jobId,Job Type,State,Start Time,Duration
job_9cd353dc7d4f4b46a00840625af82be9,load,SUCCESS,19
Aug 16:17:04,0:00:>
job_2f4aa76f1bef48268080677a556a1dbd,query,SUCCESS,15
Aug 17:39:15,0:00>
Observe that both the load job you ran and the query you issue from the
BigQuery web UI are listed. As discussed later, queries are a type of job.
For now, just keep in mind that the command-line client, unlike the web
application, does not actually distinguish between different kinds of jobs for
operations. Also the command demonstrates how you can control the output
of the client via the --format option. By default it uses tabular formatting
that is easy for humans to read, but it also supports options that are more
convenient for scripting.
Another difference between the client and web application is that the client
does not have a way to list additional datasets you might have access to
outside the currently configured project. In the web application you saw
that the publicdata:samples dataset appeared in the navigation panel.
This dataset, although not easily discoverable, is still accessible via the
command-line client.
$ bq ls publicdata:samples
tableId
Search WWH ::




Custom Search