Luiz Felipe Campos da Silva
12/03/2025, 6:53 PMkapa.ai
12/03/2025, 6:53 PMkapa.ai
12/03/2025, 6:53 PMdbt run / dbt build. ### Key points from the docs - Elementary only needs its models run once (install) and on minor version upgrades to apply schema changes. Day‑to‑day runs can safely skip them.[[OSS FAQ](https://docs.elementary-data.com/oss/general/faq)] - The on-run-start / on-run-end hooks still run and will continue to upload run/test results etc. even if the Elementary models are excluded or disabled.[[OSS FAQ](https://docs.elementary-data.com/oss/general/faq); [Slack – hooks vs models](https://elementary-community.slack.com/archives/C02CTC89LAX/p1705024991103189)] You have two main options: --- ### Option 1 – Exclude Elementary models via CLI (simplest) For your regular runs: bash dbt run --exclude elementary # or dbt build --exclude elementary This skips all package:elementary models, while hooks still execute and populate the existing Elementary tables.[[OSS FAQ](https://docs.elementary-data.com/oss/general/faq); [Slack – exclude elementary](https://elementary-community.slack.com/archives/C02CTC89LAX/p1680788180937509)] When you upgrade Elementary and need to rebuild its tables: bash dbt run --select elementary --- ### Option 2 – Disable Elementary models by default in dbt_project.yml Configure Elementary models to be disabled by default and only enable them when you explicitly choose to: yml models: elementary: +schema: elementary edr: +enabled: "{{ var('enable_elementary_models', false) }}" Then: - Normal runs (no models, hooks still run): bash dbt run - When you do want to (re)build Elementary models (e.g., after upgrade): bash dbt run --select elementary --vars '{"enable_elementary_models": true}' [[OSS FAQ](https://docs.elementary-data.com/oss/general/faq); [Slack – disable models via var](https://elementary-community.slack.com/archives/C02CTC89LAX/p1678322775440989)] --- So: use --exclude elementary or the `+enabled`/var pattern to stop Elementary models from running; the hooks will still execute and keep your observability data up to date.Luiz Felipe Campos da Silva
12/03/2025, 6:54 PMkapa.ai
12/03/2025, 6:55 PMkapa.ai
12/03/2025, 6:55 PM0.15.x → 0.16.x) when schema changes are introduced.[[OSS FAQ](https://docs.elementary-data.com/oss/general/faq); [Slack – when to run models](https://elementary-community.slack.com/archives/C02CTC89LAX/p1715108071844039)] Outside of those cases, you can configure things so they never run again automatically and only the hooks populate the tables. ### How to do it 1. Disable Elementary models by default in `dbt_project.yml`: yml models: elementary: +schema: elementary edr: +enabled: "{{ var('enable_elementary_models', false) }}" This makes Elementary models not run in normal dbt run / dbt build.[[OSS FAQ](https://docs.elementary-data.com/oss/general/faq); [Slack – disable via var](https://elementary-community.slack.com/archives/C02CTC89LAX/p1678322775440989)] 2. Run them only when you choose (install or upgrade): bash dbt run --select elementary --vars '{"enable_elementary_models": true}' Do this once per environment on install, and again only when you upgrade Elementary and need schema changes applied.[[OSS FAQ](https://docs.elementary-data.com/oss/general/faq)] The on-run-end hooks continue to run and populate the existing Elementary tables even if the models themselves are disabled or excluded.[[OSS FAQ](https://docs.elementary-data.com/oss/general/faq); [Slack – hooks vs models](https://elementary-community.slack.com/archives/C02CTC89LAX/p1715108071844039)]Luiz Felipe Campos da Silva
12/03/2025, 6:56 PMkapa.ai
12/03/2025, 6:56 PMkapa.ai
12/03/2025, 6:56 PMenable_elementary_models is not a native dbt setting or reserved keyword. It’s just an example of a user-defined var name that you can choose yourself and reference in dbt_project.yml, e.g.: yml models: elementary: +schema: elementary edr: +enabled: "{{ var('enable_elementary_models', false) }}" In this pattern, enable_elementary_models is a normal dbt var you define and control (via vars: in dbt_project.yml or --vars on the CLI) to toggle whether Elementary models are enabled. [[OSS FAQ](https://docs.elementary-data.com/oss/general/faq); [Slack – disable via var](https://elementary-community.slack.com/archives/C02CTC89LAX/p1678322775440989)]Luiz Felipe Campos da Silva
12/03/2025, 6:57 PM0.15.x → 0.16.x) when schema changes are introduced.[OSS FAQ; Slack – when to run models]
When he will know when to run these models? If the variable is always false?kapa.ai
12/03/2025, 6:58 PMkapa.ai
12/03/2025, 6:58 PMfalse by default so that normal runs never build Elementary models. - You (or your team / pipeline) manually flip it to true only when you decide to rebuild Elementary models (install or minor upgrade). Elementary itself does not auto‑toggle this flag; you control it. A common pattern from the docs and Slack answers is: yml # dbt_project.yml models: elementary: +schema: elementary edr: +enabled: "{{ var('enable_elementary_models', false) }}" Normal jobs: bash dbt run # var defaults to false → models not built # or dbt build When you want to rebuild (first install, or minor version upgrade): bash dbt run --select elementary --vars '{"enable_elementary_models": true}' This is a deliberate, manual action you wire into your deployment/upgrade process (e.g., a “post‑upgrade” job that runs dbt deps + dbt run --select elementary --vars ...). [[OSS FAQ](https://docs.elementary-data.com/oss/general/faq); [Slack – disable via var](https://elementary-community.slack.com/archives/C02CTC89LAX/p1678322775440989); [Slack – when to run models](https://elementary-community.slack.com/archives/C02CTC89LAX/p1715108071844039)]Luiz Felipe Campos da Silva
12/03/2025, 7:01 PMkapa.ai
12/03/2025, 7:01 PMkapa.ai
12/03/2025, 7:02 PMdbt_project.yml, configure Elementary like this: yml models: elementary: +schema: elementary edr: +enabled: "{{ var('enable_elementary_models', false) }}" This follows the pattern documented in the FAQ: models are disabled by default and only run when enable_elementary_models is explicitly set to true.[[OSS FAQ](https://docs.elementary-data.com/oss/general/faq)] Result: - dbt run / dbt build (no special vars) → Elementary models do not run. - Hooks still run and upload results, assuming the tables exist.[[OSS FAQ](https://docs.elementary-data.com/oss/general/faq)] --- ### 2. First‑time (and upgrade) instructions in the template In your template’s README, add a clear “initialization” step: bash # One-time setup (and on minor Elementary upgrades) dbt run --select elementary --vars '{"enable_elementary_models": true}' This is exactly what Elementary recommends: run the models once on install and on minor version upgrades.[[OSS FAQ](https://docs.elementary-data.com/oss/general/faq)] So: - Yes, for the first run, enable_elementary_models must be true. - But you don’t hard‑code it to true in the project; you only pass it via --vars in that one command. Day‑to‑day, users just run dbt run / dbt build with no vars, and models stay off. --- ### 3. About disable_dbt_artifacts_autoupload disable_dbt_artifacts_autoupload and the other vars control what the hooks upload, not whether the models themselves run. [[OSS FAQ](https://docs.elementary-data.com/oss/general/faq); [Slack – disable hooks](https://elementary-community.slack.com/archives/C02CTC89LAX/p1677157737267389)] For example, to fully disable uploads in some env: yml vars: disable_run_results: true disable_tests_results: true disable_dbt_artifacts_autoupload: true disable_dbt_invocation_autoupload: true But these **do not stop dbt from trying to build the models**; that’s what the `+enabled`/`var('enable_elementary_models', false)` pattern is for. --- ### TL;DR for your template - Put this in `dbt_project.yml`: yml models: elementary: +schema: elementary edr: +enabled: "{{ var('enable_elementary_models', false) }}" - Document one explicit “setup” command for first‑timers (and upgrades): bash dbt run --select elementary --vars '{"enable_elementary_models": true}' This way: - First‑timers have a clear, single step to initialize. - Normal project runs never keep rebuilding Elementary models.Luiz Felipe Campos da Silva
12/03/2025, 7:43 PMkapa.ai
12/03/2025, 7:43 PMkapa.ai
12/03/2025, 7:44 PM--exclude in dbt_project.yml so that every dbt build automatically excludes a package. What is documented are these options: 1. Disable the Elementary package by config (per target/env) Example patterns: yml models: elementary: +schema: "elementary" +enabled: "{{ target.name in ['prod','analytics'] }}" This means in all other targets, Elementary models won’t run at all, regardless of CLI flags.[[OSS FAQ](https://docs.elementary-data.com/oss/general/faq); [Disable per env](https://elementary-community.slack.com/archives/C02CTC89LAX/p1684138562765719)] Or using a var: yml models: elementary: +schema: elementary edr: +enabled: "{{ var('enable_elementary_models', false) }}" Then you only enable them explicitly with --vars '{"enable_elementary_models": true}' when needed.[[OSS FAQ](https://docs.elementary-data.com/oss/general/faq); [Disable via var](https://elementary-community.slack.com/archives/C02CTC89LAX/p1678322775440989)] 2. Use --exclude elementary or --exclude package:elementary in your commands This is repeatedly suggested for skipping Elementary models/tests in specific runs, including CI and micro‑batches, e.g.: ```bash dbt run --exclude elementary dbt build --exclude elementary ```[[OSS FAQ](https://docs.elementary-data.com/oss/general/faq); [Slack – exclude elementary](https://elementary-community.slack.com/archives/C02CTC89LAX/p1693288324394649); [Micro-batch example](https://elementary-community.slack.com/archives/C02CTC89LAX/p1747229110843109)] Given the provided sources, they do not show a way to encode a “default --exclude for every build” directly in `dbt_project.yml`; instead, they rely on: - +enabled conditions (per env/var), or - Explicit CLI --exclude usage. If you need it to always be excluded in a certain environment, the recommended pattern here is the +enabled condition rather than a global default CLI flag.