01 Dec 20 ·  mCollins in bigquery ·        Bookmark ·  Report ·  More actions.. Lock comments ·  Pin thread

BQ command line - Check if a BigQuery dataset exists before creating it

To create a new dataset in Bigquery, you will run the below command from the CLI:

bq mk dataset

But, There are times when you want to create a dataset in BigQuery only when it doesn't exists. In order to do that you can follow the below syntax:

bq show $dataset || bq mk $dataset


posted on 01 Dec 20

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds