<@U088WCP3B4P> How can I disable elementary with a...
# ask-elementary-ai
l
@kapa.ai How can I disable elementary with an environment variable? I have
ENABLE_ELEMENTARY=false
and the following in
dbt_project.yml
, but still get the autoupload hooks when I do
dbt run
:
Copy code
elementary:
    +schema: elementary
    +enabled: "{{ env_var('ENABLE_ELEMENTARY', 'false') == 'true' }}"
k
A message from kapa.ai
To fully disable Elementary—including its models and on-run-end hooks—using an environment variable, you need to address both the model enablement and the hook execution. Your current approach only disables the models, but the hooks are controlled separately via specific variables. Here's how you can do it: 1. Disable the models (as you are already doing):
Copy code
yaml models:   elementary:     +schema: elementary     +enabled: "{{ env_var('ENABLE_ELEMENTARY', 'false') == 'true' }}"
2. Disable the on-run-end hooks by setting the following variables in your
dbt_project.yml
, all referencing your environment variable:
Copy code
yaml vars:   disable_run_results: "{{ env_var('ENABLE_ELEMENTARY', 'false') != 'true' }}"   disable_tests_results: "{{ env_var('ENABLE_ELEMENTARY', 'false') != 'true' }}"   disable_dbt_artifacts_autoupload: "{{ env_var('ENABLE_ELEMENTARY', 'false') != 'true' }}"   disable_dbt_invocation_autoupload: "{{ env_var('ENABLE_ELEMENTARY', 'false') != 'true' }}"
With this setup, setting
ENABLE_ELEMENTARY=false
will disable both the models and the hooks. Make sure the environment variable is exported in your shell or CI environment before running dbt. Note: The hooks are not controlled by the
+enabled
config alone; you must set the disablement vars as shown above. This is a common point of confusion, as documented in the knowledge sources [[FAQ](https://docs.elementary-data.com/oss/general/faq)]. If you are still seeing hooks run after setting these variables, ensure: - The environment variable is correctly set and available to the dbt process. - You are not overriding these vars elsewhere (e.g., via CLI or another config). - You are using a recent version of Elementary, as some older versions had issues with disablement logic [[Slack thread](https://slack.com/archives/C02CTC89LAX/p1711530856757159)]. Let me know if you need help troubleshooting further!
l
@kapa.ai I used the code for 2. but still get the hooks:
Copy code
16:11:36  1 of 1 START hook: elementary.on-run-start.0 ................................... [RUN]
16:11:36  1 of 1 OK hook: elementary.on-run-start.0 ...................................... [OK in 0.04s]
16:11:36  
16:11:36  1 of 1 START sql table model testing.table_model ............................... [RUN]
16:11:37  1 of 1 OK created sql table model testing.table_model .......................... [SUCCESS 1 in 1.04s]
16:11:37  
16:11:37  1 of 1 START hook: elementary.on-run-end.0 ..................................... [RUN]
16:11:37  1 of 1 OK hook: elementary.on-run-end.0 ........................................ [OK in 0.02s]
16:11:38  
16:11:38  Finished running 2 project hooks, 1 table model in 0 hours 0 minutes and 7.31 seconds (7.31s).
16:11:38
k
A message from kapa.ai
The behavior you're seeing—where the Elementary hooks (
on-run-start
and
on-run-end
) still appear in the logs—matches what is described in the knowledge sources. Even when you set all the disablement variables, the hooks themselves will still run, but if the variables are set correctly, the hooks should not actually upload any data or perform their usual actions. The hook macros check the variables and, if disabled, exit without doing anything significant. From the sources: > The hook runs anyway, and check your vars. > If all are set to disabled, nothing happens: > > Community Member 212: But it still ran, but that is okay or? > > Trusted Support Staff 144: The hook runs anyway, and check your vars. If all are set to disabled, nothing happens [[Slack thread](https://slack.com/archives/C02CTC89LAX/p1669625539486519)]. So, seeing the hooks in the output is expected. What matters is that, with the disablement vars set, the hooks do not actually upload artifacts or results. If you want to completely remove the hooks from the run logs, that is not currently supported by Elementary—disabling the package with
+enabled
will prevent the models from being created, but if you have dependencies on Elementary tables, this may cause compilation errors [[FAQ](https://docs.elementary-data.com/oss/general/faq)]. Summary: - The hooks will always appear in the logs, but with the correct vars, they should not perform any uploads or actions. - This is the intended and documented behavior. If you are still seeing data uploads or actions performed by the hooks (not just the log lines), then there may be an issue with how the variables are set or passed to dbt. Double-check that the environment variable is available to dbt and that the vars are not being overridden elsewhere.
l
@kapa.ai where should I check if elementary did upload anything?
k
A message from kapa.ai
To check if Elementary actually uploaded anything, you should look at the tables in your Elementary schema—specifically, the tables that store metadata and results. The most relevant tables to inspect are: -
dbt_models
-
dbt_tests
-
dbt_sources
-
dbt_run_results
-
elementary_test_results
-
dbt_invocations
If the disablement variables are set correctly, these tables should not be updated with new data after your dbt run. You can query these tables to see if any new rows have been inserted after your run. This approach is confirmed in the knowledge sources, where users check for new data in these tables to verify whether uploads occurred: > "I just tried your command. There was no new data in the table
dbt_models
, and run results were still uploaded." > "Your results will be uploaded regardless because running the models and uploading the results are two different things. Running Elementary's tables creates its tables and the on-run-end hook is in charge of populating them. Therefore, you can just not run Elementary's tables and the results will still be uploaded." > — [Slack thread](https://slack.com/archives/C02CTC89LAX/p1705024991103189) So, to confirm whether Elementary uploaded anything, check for new or updated rows in the tables listed above in your data warehouse's Elementary schema.