Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BQ command line tool -- how to check if a BigQuery dataset exists before creating it?

Using the BigQuery command-line tool, how can I check if a dataset exists before creating it?

bq mk dataset

reports an error if you try to call it on an already existing dataset.

like image 391
Lak Avatar asked Oct 24 '25 22:10

Lak


1 Answers

A shorter solution:

bq show $dataset || bq mk $dataset
like image 83
jeroko Avatar answered Oct 28 '25 04:10

jeroko