dbt

Disable elementary from DBT CLI when running dbt test


I have Elementary installed in my DBT project:

# packages.yml
packages:
  - package: elementary-data/elementary
    version: 0.9.0

# dbt_project.yml
models:
  elementary:
    +schema: elementary

When I run DBT from the CLI, elementary will open connections and model executions, as well as test executions + results. I'd like to disable elementary's behavior, from the CLI. (Not sure if it's possible...)

An ideal solution would be a CLI flag:

dbt run -s my_model --disable-elementary

(I do not want to alter my profiles... or dbt_project.yml)


Solution

  • I use an environment variable for this that is read in from dbt_project.yml (I know you said you don't want to alter dbt_project.yml, but this is dynamic):

    models:
      elementary:
        +schema: "elementary"
        +enabled: "{{ env_var('DBT_ELEMENTARY_ENABLED') | as_bool }}"