<@U088WCP3B4P> How to disable metadata tables in E...
# ask-elementary-ai
l
@kapa.ai How to disable metadata tables in Elementary hooks? Just like dbt_models or dbt_columns
k
A message from kapa.ai
You can disable Elementary’s metadata updates (including
dbt_models
and optionally
dbt_columns
) via
vars
in
dbt_project.yml
and/or by disabling specific models. ### 1. Disable all metadata model updates in the hooks This stops the
on-run-end
hook from updating any metadata tables (
dbt_models
,
dbt_tests
,
dbt_sources
, etc.):
Copy code
yml vars:   disable_dbt_artifacts_autoupload: true
[[On-run-end hooks](https://docs.elementary-data.com/dbt/on-run-end_hooks#can-i-disable-the-on-run-end-hooks%3F)] If you do this, Elementary recommends manually updating the artifacts on deploys:
Copy code
bash dbt run --select elementary.edr.dbt_artifacts
[[On-run-end hooks](https://docs.elementary-data.com/dbt/on-run-end_hooks)] ### 2. Disable only
dbt_columns
uploads (keep other metadata) If you want to keep other metadata tables up to date but skip `dbt_columns`:
Copy code
yml vars:   disable_dbt_columns_autoupload: true
[[On-run-end hooks](https://docs.elementary-data.com/dbt/on-run-end_hooks#can-i-disable-the-on-run-end-hooks%3F)] ### 3. Disable the
dbt_columns
/ information_schema models entirely If the problem is with the models themselves (e.g., permissions or performance), you can disable them like any dbt model:
Copy code
yml models:   elementary:     edr:       dbt_artifacts:         dbt_columns:           +enabled: false       metadata_store:         +enabled: false      # disables all metadata_store models, incl. filtered_information_schema_*
[[BQ permissions thread](https://elementary-community.slack.com/archives/C02CTC89LAX/p1687786100077469?thread_ts=1687786100.077469&amp;cid=C02CTC89LAX); [Tables.list / IS threads](https://elementary-community.slack.com/archives/C02CTC89LAX/p1686855852542619?thread_ts=1686855852.542619&amp;cid=C02CTC89LAX)] If you only want to disable a single metadata_store model (e.g.
filtered_information_schema_columns
):
Copy code
yml models:   elementary:     edr:       metadata_store:         filtered_information_schema_columns:           +enabled: false
[[Databricks IS thread](https://elementary-community.slack.com/archives/C02CTC89LAX/p1693840882682879?thread_ts=1693840882.682879&amp;cid=C02CTC89LAX)] --- In practice: - Use
disable_dbt_artifacts_autoupload
/
disable_dbt_columns_autoupload
to control what the hooks update. - Use
+enabled: false
on specific models if you don’t want those tables built at all.
l
Copy code
disable_dbt_artifacts_autoupload: true
this also disables run_results upload? @kapa.ai
k
A message from kapa.ai
No, setting
Copy code
yml vars:   disable_dbt_artifacts_autoupload: true
only disables metadata (“artifacts”) uploads such as
dbt_models
,
dbt_tests
,
dbt_sources
, and optionally
dbt_columns
. It does not stop
run_results
/
elementary_test_results
/ invocation rows from being written. [[On‑run‑end hooks](https://docs.elementary-data.com/dbt/on-run-end_hooks#can-i-disable-the-on-run-end-hooks%3F); [BQ concurrency thread](https://elementary-community.slack.com/archives/C02CTC89LAX/p1692802428509179?thread_ts=1692802428.509179&amp;cid=C02CTC89LAX)] To disable result uploads you would additionally set:
Copy code
yml vars:   disable_run_results: true   disable_tests_results: true   disable_dbt_invocation_autoupload: true
[[On‑run‑end hooks](https://docs.elementary-data.com/dbt/on-run-end_hooks#can-i-disable-the-on-run-end-hooks%3F)]
l
@kapa.ai Why my packages configurations are having more importance when the views are built?
k
A message from kapa.ai
In dbt, configs defined inside a package’s own
dbt_project.yml
are evaluated as part of that package’s project
, and then your root project can only override them in specific, higher‑priority places (e.g. at the model level or under your own project name in
dbt_project.yml
). If the override is placed at the wrong hierarchy, the package’s config “wins” and controls how views/tables are built. From the Elementary threads, there are two common patterns where this shows up: 1. Elementary (or any package) is configured at the wrong level in your root
dbt_project.yml
If you nest
elementary
under your own project key, dbt treats that config as belonging to
my_project.elementary
(a sub‑folder), not the
elementary
package. In that case the package’s own configs take precedence. Wrong:
Copy code
yml    models:      academia:        elementary:          +schema: elementary    # applies to academia/elementary, not the package
Correct:
Copy code
yml    models:      elementary:        +schema: elementary      # this targets the package      academia:        # your project’s models…
[[Multi‑project schema thread](https://elementary-community.slack.com/archives/C02CTC89LAX/p1669676588368489?thread_ts=1669676588.368489&amp;cid=C02CTC89LAX); [IS schema thread](https://elementary-community.slack.com/archives/C02CTC89LAX/p1680270133127419?thread_ts=1680270133.127419&amp;cid=C02CTC89LAX)] 2. Global configs in your root project are overriding package‑level materializations If you declare a global
models:
block with
materialized: table
at the top level, that can override package models unless you scope it to your own project name only. This is why Elementary’s docs explicitly recommend:
Copy code
yml    models:      my_project:        materialized: "{{ 'table' if target.name == 'prod-cloud' else 'view' }}"       elementary:        +schema: "elementary"
so the global materialization does not affect Elementary’s incremental models. [[Quickstart dbt‑package](https://docs.elementary-data.com/oss/quickstart/quickstart-cli-package#step-by-step%3A-install-elementary-dbt-package)] A user who had
models: materialized: table
at the very top saw Elementary’s incremental models getting rebuilt as tables; moving that config under their own project key fixed it. [[dbt_invocations override thread](https://elementary-community.slack.com/archives/C02CTC89LAX/p1698507102830499?thread_ts=1698507102.830499&amp;cid=C02CTC89LAX)] --- What to check in your project 1. In your root
dbt_project.yml
, ensure global configs are scoped:
Copy code
yml    models:      my_project:          # your project name        materialized: view # or your logic      elementary:        +schema: elementary
2. If you’re developing your own package, remember: - Vars must have defaults inside the package, and can then be overridden from the root project. [[Package vars thread](https://elementary-community.slack.com/archives/C02CTC89LAX/p1684508852749729?thread_ts=1684508852.749729&amp;cid=C02CTC89LAX)] - The package’s
dbt_project.yml
is compiled independently; root‑project vars/configs don’t exist there unless explicitly overridden at the correct hierarchy. If you share the relevant part of your
dbt_project.yml
(root + package), I can point to the exact place where the package config is taking precedence.
l
@kapa.ai name: 'elementary_test2' version: '1.0.0' config-version: 2 # This setting configures which "profile" dbt uses for this project. profile: 'elementary_test2' # These configurations specify where dbt should look for different types of files. # For Databricks asset bundles, we put everything in src, as you may have # non-dbt resources in your project. model-paths: ["src/models"] analysis-paths: ["src/analyses"] test-paths: ["src/tests"] seed-paths: ["src/seeds"] macro-paths: ["src/macros"] snapshot-paths: ["src/snapshots"] clean-targets: # directories to be removed by
dbt clean
- "target" - "dbt_packages" - "logs" vars: disable_dbt_artifacts_autoupload: true macros_nexus: catalog: "platform" schema: "dummy_dbt2_metrics" # Configuring models # Full documentation: https://docs.getdbt.com/docs/configuring-models # In this example config, we tell dbt to build all models in the example/ # directory as views by default. These settings can be overridden in the # individual model files using the
{{ config(...) }}
macro. models: +persist_docs: relation: true columns: true elementary_test2: example: +materialized: view elementary +schema: metrics +enabled: "{{ target.name in ('prod') and var('ELEMENTARY_ENABLED', true) }}" edr: dbt_artifacts: +enabled: "{{var('ARTIFACTS_ENABLED', false)}}" on-run-start: - "{{ macros_nexus.check_select_arg() if target.name == 'local' else 'select 1' }}" macros_nexus schema is taking precedence when building the job_run_results view look:
Copy code
from
      `platform`.`general_elementary_metrics`.`dbt_invocations`
It should be dummy_dbt2_metrics instead of this
k
A message from kapa.ai
Your
elementary
config isn’t actually being applied, so dbt falls back to whatever your
generate_schema_name
/ macros_nexus logic says (which points to
general_elementary_metrics
). This is the same indentation / scoping issue shown in multiple Elementary threads. [[Separate schema thread](https://elementary-community.slack.com/archives/C02CTC89LAX/p1680270133127419?thread_ts=1680270133.127419&amp;cid=C02CTC89LAX); [Config path unused thread](https://elementary-community.slack.com/archives/C02CTC89LAX/p1691614851612199?thread_ts=1691614851.612199&amp;cid=C02CTC89LAX)] ### 1. Fix the
models:
indentation You currently have:
Copy code
yml models:   +persist_docs:     relation: true     columns: true   elementary_test2:     example:       +materialized: view   elementary     +schema: metrics     +enabled: "{{ target.name in ('prod') and var('ELEMENTARY_ENABLED', true) }}"     edr:       dbt_artifacts:         +enabled: "{{var('ARTIFACTS_ENABLED', false)}}"
elementary
is missing a colon and is not a proper key; dbt will ignore that block, so your package configs don’t apply. You want:
Copy code
yml models:   +persist_docs:     relation: true     columns: true    elementary_test2:     example:       +materialized: view    elementary:                          # <- colon, same level as elementary_test2     +schema: metrics     +enabled: "{{ target.name in ('prod') and var('ELEMENTARY_ENABLED', true) }}"     edr:       dbt_artifacts:         +enabled: "{{ var('ARTIFACTS_ENABLED', false) }}"
This pattern (package name as a top‑level key under
models:
) is exactly what Elementary support recommend; when it was nested incorrectly, configs were ignored and the default/custom schema logic took precedence. [[Same‑schema issue](https://elementary-community.slack.com/archives/C02CTC89LAX/p1684341029701899?thread_ts=1684341029.701899&amp;cid=C02CTC89LAX); [Unused config path fix](https://elementary-community.slack.com/archives/C02CTC89LAX/p1691614851612199?thread_ts=1691614851.612199&amp;cid=C02CTC89LAX)] ### 2. Re‑run Elementary models After fixing
dbt_project.yml
, re‑run Elementary models so views (including
job_run_results
) are rebuilt in the correct schema:
Copy code
bash dbt run --select elementary
[[Config / schema threads](https://elementary-community.slack.com/archives/C02CTC89LAX/p1712851926036669?thread_ts=1712851926.036669&amp;cid=C02CTC89LAX)] ### 3. Why macros_nexus “wins” Your custom schema logic (in
generate_schema_name
or equivalent) always applies unless you correctly scope configurations to the
elementary
package. When the
elementary
block is malformed/ignored, dbt only sees your global / macros_nexus rules, so it keeps using
platform.general_elementary_metrics
. This is the same behavior others saw when a custom
generate_schema_name
or global config was affecting Elementary until they either: - Scoped configs under
models: elementary: ...
, or - Added a special case in the macro for
node.package_name == 'elementary'
. [[Custom schema override](https://elementary-community.slack.com/archives/C02CTC89LAX/p1712851926036669?thread_ts=1712851926.036669&amp;cid=C02CTC89LAX); [Generate_schema_name exclusion](https://elementary-community.slack.com/archives/C02CTC89LAX/p1680270133127419?thread_ts=1680270133.127419&amp;cid=C02CTC89LAX)] If, after fixing the indentation, you still see
general_elementary_metrics
, you’ll need to add such a special case in your schema macro for
node.package_name == 'elementary'
.
l
@kapa.ai I'm sorry I send you the wrong code block, It's actually with this colon, the problem is not related to this, macros_nexus schema is still wining
k
A message from kapa.ai
Your issue matches the pattern where a custom schema macro is still controlling Elementary models, even though the
models: elementary:
block is correct. The key detail from similar cases: Elementary will respect your custom schema logic unless you explicitly special‑case the
elementary
package
in that macro. Several users saw exactly this: configs like
Copy code
yml models:   elementary:     +schema: elementary
were ignored because their
generate_schema_name
(or equivalent) macro always forced another schema (e.g.
TRANSFORMED_*
,
general_elementary_metrics
). The fix was to handle
node.package_name == 'elementary'
differently in the macro so that the package’s
+schema:
wins. [[Custom schema override](https://elementary-community.slack.com/archives/C02CTC89LAX/p1712851926036669?thread_ts=1712851926.036669&amp;cid=C02CTC89LAX); [Alternative pattern fix](https://elementary-community.slack.com/archives/C02CTC89LAX/p1678390370071829?thread_ts=1678390370.071829&amp;cid=C02CTC89LAX)] ### What to change In your custom schema macro (the one macros_nexus uses, equivalent to
generate_schema_name
), add a branch for the Elementary package. Conceptually:
Copy code
jinja {% macro generate_schema_name(custom_schema_name, node) -%}     {%- set default_schema = target.schema -%}      {% if node.package_name == 'elementary' and custom_schema_name %}         {{ default_schema }}_{{ custom_schema_name | trim }}     {% else %}         {{ generate_schema_name_for_env(custom_schema_name, node) }}     {% endif %} {%- endmacro %}
This pattern comes directly from Elementary support’s guidance for users whose custom schema logic was overriding the Elementary schema; once they added the
node.package_name == 'elementary'
branch, Elementary models started going to the configured schema (e.g.
..._elementary
) instead of the macro’s default (
TRANSFORMED_*
,
general_elementary_metrics
, etc.). [[Custom schema override](https://elementary-community.slack.com/archives/C02CTC89LAX/p1712851926036669?thread_ts=1712851926.036669&amp;cid=C02CTC89LAX); [Docs alt‑pattern fix](https://elementary-community.slack.com/archives/C02CTC89LAX/p1678390370071829?thread_ts=1678390370.071829&amp;cid=C02CTC89LAX)] After updating the macro: 1. Re‑run the Elementary models so the views are rebuilt in the correct schema:
Copy code
bash    dbt run --select elementary
2. Then re‑run your tests / jobs. If you can paste your actual schema macro (from macros_nexus), I can show the exact minimal change that preserves your current behavior for everything else while letting
models: elementary: +schema: metrics
win for Elementary.
l
@kapa.ai I don't think that would help like look at my macro: {% macro generate_schema_name(custom_schema_name, node) -%} {%- set default_schema = target.schema -%} {%- if custom_schema_name is none or custom_schema_name | trim == '' -%} {{ default_schema }} {%- elif custom_schema_name | trim == 'general_elementary_metrics'-%} {{ custom_schema_name | trim }} {%- else -%} {{ default_schema }}_{{ custom_schema_name | trim }} {%- endif -%} {%- endmacro %}
k
A message from kapa.ai
Your macro is forcing
general_elementary_metrics
as a literal schema name, which is why it keeps winning over your
+schema: metrics
config. Here’s what it does:
Copy code
jinja {% macro generate_schema_name(custom_schema_name, node) -%}     {%- set default_schema = target.schema -%}     {%- if custom_schema_name is none or custom_schema_name | trim == '' -%}         {{ default_schema }}     {%- elif custom_schema_name | trim == 'general_elementary_metrics'-%}         {{ custom_schema_name | trim }}          # <- hard‑codes schema "general_elementary_metrics"     {%- else -%}         {{ default_schema }}_{{ custom_schema_name | trim }}     {%- endif -%} {%- endmacro %}
For Elementary: - Your
dbt_project.yml
has:
Copy code
yml   models:     elementary:       +schema: metrics
- So
custom_schema_name
for Elementary models is
metrics
. - That hits the
else
branch, which returns
{{ default_schema }}_metrics
(e.g.
dummy_dbt2_metrics
), unless something in your setup is passing
general_elementary_metrics
as the custom schema for those models. From similar Slack threads, the usual fix is: 1. Special‑case the Elementary package in
generate_schema_name
, so its
+schema:
is applied literally, regardless of other logic. For example (pattern taken from other users who had custom schema macros overriding Elementary): [[Custom schema override](https://elementary-community.slack.com/archives/C02CTC89LAX/p1712851926036669?thread_ts=1712851926.036669&amp;cid=C02CTC89LAX)]
Copy code
jinja    {% macro generate_schema_name(custom_schema_name, node) -%}        {%- set default_schema = target.schema -%}         {% if node.package_name == 'elementary' and custom_schema_name %}            {# respect the +schema on Elementary models (e.g. "metrics") #}            {{ custom_schema_name | trim }}        {% elif custom_schema_name is none or custom_schema_name | trim == '' -%}            {{ default_schema }}        {% elif custom_schema_name | trim == 'general_elementary_metrics'-%}            {{ custom_schema_name | trim }}        {% else -%}            {{ default_schema }}_{{ custom_schema_name | trim }}        {% endif %}    {%- endmacro %}
This is the same approach Elementary support recommended when users’ custom
generate_schema_name
macros kept routing Elementary tables to the wrong schema until they added a
node.package_name == 'elementary'
branch. [[Package exclusion pattern](https://elementary-community.slack.com/archives/C02CTC89LAX/p1678390370071829?thread_ts=1678390370.071829&amp;cid=C02CTC89LAX); [Similar override issue](https://elementary-community.slack.com/archives/C02CTC89LAX/p1712851926036669?thread_ts=1712851926.036669&amp;cid=C02CTC89LAX)] 2. Then re‑run Elementary models so they get rebuilt into the intended schema:
Copy code
bash    dbt run --select elementary
If after this you still see
general_elementary_metrics
in the
FROM
of
job_run_results
, it means something (a config or macro) is explicitly giving Elementary models that
custom_schema_name
, and we’d need to inspect those configs; the shared sources don’t contain more specific guidance for that exact interaction.
l
@kapa.ai This variable exists? elementary_database: "platform" elementary_schema: "dummy_dbt2_metrics" They can fix my problem?\
k
A message from kapa.ai
Those exact variables (
elementary_database
,
elementary_schema
) do not appear in the Elementary docs or Slack threads you shared, so I can’t confirm they exist or are read by Elementary. I would not expect them alone to fix your problem. From the sources, Elementary’s location is controlled via standard dbt configs in
dbt_project.yml
, not via custom vars like that:
Copy code
yml models:   elementary:     +database: <your_database>     +schema: <your_schema>
This is the documented way to force Elementary to always use a specific database and schema (for example on BigQuery, to always write to project A + dataset
elementary
). [[BQ multi-project](https://elementary-community.slack.com/archives/C02CTC89LAX/p1681162450753059?thread_ts=1681162450.753059&amp;cid=C02CTC89LAX); [Quickstart dbt package](https://docs.elementary-data.com/oss/quickstart/quickstart-cli-package#step-by-step%3A-install-elementary-dbt-package)] So: - I’m not aware of built‑in vars named
elementary_database
/
elementary_schema
in Elementary. - To fix your issue, use
+database
and
+schema
under
models: elementary:
in
dbt_project.yml
, and ensure your
generate_schema_name
macro doesn’t override that for the
elementary
package. [[Change Elementary schema](https://docs.elementary-data.com/oss/general/faq#can-i-change-the-elementary-schema%3F); [Custom schema macro examples](https://elementary-community.slack.com/archives/C02CTC89LAX/p1678390370071829?thread_ts=1678390370.071829&amp;cid=C02CTC89LAX)] If you want, paste your updated
models: elementary:
block and I can align it to the patterns from the docs.
l
@kapa.ai How to disable only the elementary views from being enabled in dbt_project.yml?
k
A message from kapa.ai
You can’t target only “views” as a group in Elementary from the docs we have, but you can disable specific Elementary models (including the ones that are materialized as views) via normal dbt model configs in
dbt_project.yml
. [[Disable models](https://elementary-community.slack.com/archives/C02CTC89LAX/p1686218882162339?thread_ts=1686218882.162339&amp;cid=C02CTC89LAX)] ### 1. Disable specific Elementary models (view models) Look up which Elementary models are views, then disable them explicitly:
Copy code
yml models:   elementary:     edr:       metadata_store:         filtered_information_schema_tables:           +enabled: false         filtered_information_schema_columns:           +enabled: false       dbt_artifacts:         dbt_models:           +enabled: false         dbt_columns:           +enabled: false
This pattern (drilling down to the model path and setting
+enabled: false
) is what support recommends when you want to turn off individual Elementary models. [[Disable specific models](https://elementary-community.slack.com/archives/C02CTC89LAX/p1686218882162339?thread_ts=1686218882.162339&amp;cid=C02CTC89LAX)] Be aware: disabling some of these (especially the
information_schema
ones) will disable related features such as
schema_changes
tests. [[Info schema note](https://elementary-community.slack.com/archives/C02CTC89LAX/p1686218882162339?thread_ts=1686218882.162339&amp;cid=C02CTC89LAX)] ### 2. Disable all Elementary models by default, then re‑enable only what you need If the goal is to effectively skip most Elementary models (many of which are views) on regular runs, you can invert the logic and control them with a var: [[FAQ – disable models](https://docs.elementary-data.com/oss/general/faq#can-i-disable--exclude-the-elementary-models%3F)]
Copy code
yml models:   elementary:     +schema: elementary     edr:       +enabled: "{{ var('enable_elementary_models', false) }}"
Then only run them explicitly when needed:
Copy code
bash dbt run --select elementary --vars '{"enable_elementary_models": true}'
From the knowledge we have, there is no built‑in Elementary setting that says “disable only view materializations automatically”; you must either disable specific models or use the var‑based pattern above.
l
@kapa.ai Can I have a package that has models with the same name from the elementary?
k
A message from kapa.ai
Yes, you can have models in your own package/project with the same names as Elementary models, but you need to avoid conflicting them in the same schema and namespace. From the docs and Slack threads, Elementary is just another dbt package, so its models are addressed by package path, e.g.
elementary.edr.dbt_run_results
. [[Dbt package overview](https://docs.elementary-data.com/guides/modules-overview/dbt-package)] You control where those models are built (schema/database) via the
models: elementary:
block:
Copy code
yml models:   my_project:     # your models    elementary:     +schema: elementary      # or a dedicated schema like <target_schema>_elementary
[[Quickstart dbt package](https://docs.elementary-data.com/oss/quickstart/quickstart-cli-package#step-by-step%3A-install-elementary-dbt-package)] As long as: 1. Elementary models are in their own schema (recommended), and 2. Your package’s models with the same names are in a different schema (or at least different database/schema combo), the warehouse objects won’t collide even if the model names are identical. If you put both into the same database + schema and use the same relation names, they will conflict (dbt will try to create/replace the same table or view). The sources you provided don’t describe any special Elementary mechanism to automatically resolve such naming clashes, so the safe pattern is to keep Elementary in a dedicated schema and avoid reusing the exact same relation names there. [[Elementary schema FAQ](https://docs.elementary-data.com/oss/general/faq#can-i-change-the-elementary-schema%3F)]