Add to your packages.yml
file:
# packages.yml
packages:
- git: "https://github.com/dbt-labs/dbt_helpers"
revision: 0.1
Run the following:
dbt deps
clean_workspace
Adapted from dbt_workspace to work on databricks.
dbt run-operation clean_workspace
Uses the show schemas
syntax to list schemas that match a regex pattern.
Args:
dry_run
(bool
, defaultTrue
):- Dry run flag. If
True
, will simply print out matching schemas. IfFalse
, will drop matching schemas.
- Dry run flag. If
schemas_like
(string
, defaultNone
):- Case-insensitive regex pattern to search for. Note that with databricks, this is a regex, so to match a schema with the name
dbt_cloud_pr_123
, we would use the string"dbt_cloud_pr*"
and not"dbt_cloud_pr%"
.
- Case-insensitive regex pattern to search for. Note that with databricks, this is a regex, so to match a schema with the name
Examples:
dbt run-operation clean_workspace --args '{schema_like: "dbt_cloud_pr*"}'
# Prints out schemas that match the regex pattern above - e.g. "dbt_cloud_pr_123", "dbt_cloud_pr_test_123".
dbt run-operation clean_workspace --args '{schema_like: "dbt_cloud_pr*", dry_run: False}'
# Drops schemas that match the regex pattern above.