DBT errors out when using BigQuery datasets that begin with underscores #873
Labels
bigquery
bug
Something isn't working
good_first_issue
Straightforward + self-contained changes, good for new contributors!
In BigQuery, datasets that begin with underscores are hidden in the UI and API. As a result, when DBT checks for the existence of a dataset, it doesn't find it, tries to create it, then errors out because the dataset already exists. There are a couple of ways to handle this:
Prevent the Exception
I think this can be fixed by adding
include_all=True
as a parameter inlist_datasets()
and changing thecreate_schema
method to check for the existence of the dataset id in the output ofget_existing_schemas
instead of usingget_dataset
Handle the Exception
When this occurs, BigQuery responds with a 409 response code:
409 POST https://www.googleapis.com/bigquery/v2/projects/<project_id>/datasets: Already Exists: Dataset <project_id>:<table_name>
create_schema
could be modified to interpret a 409 response code as success.The text was updated successfully, but these errors were encountered: