Yaakov Bressler
Yaakov Bressler

Reputation: 12018

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)

Upvotes: 5

Views: 1550

Answers (2)

geo909
geo909

Reputation: 434

There seems to be a native option for disabling elementary runs, as described in their documentation here.

If one was to disable it by default in the default dev environment (i.e. "from the cli", in your own words), they would use something like the below in dbt_project.yml:

vars:
  disable_run_results: true
  disable_tests_results: true
  disable_dbt_invocation_autoupload: "{{ target.name != 'prod' }}"

However, as noted in their documentation, you can also avoid having those in dbt_project.yml and pass their values as parameters from the command line, if this is what you wish:

Please note you can also use the vars in your command line rather than in the dbt_project.yml file, by adding --vars '{"disable_dbt_artifacts_autoupload": true}' to your command line.

Upvotes: 1

Adam Kipnis
Adam Kipnis

Reputation: 10971

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 }}"

Upvotes: 2

Related Questions