Luiz Felipe Campos da Silva
11/03/2025, 8:07 PMplatform.dummy_dbt.elementary_test_results cannot be found. Verify the spelling and correctness of the schema and catalog.
If you did not qualify the name with a schema, verify the current_schema() output, or qualify the name with the correct schema and catalog.
To tolerate the error on drop use DROP VIEW IF EXISTS or DROP TABLE IF EXISTS. SQLSTATE: 42P01; line 4 pos 18
192034
192034 compiled code at target/compiled/elementary/models/edr/alerts/alerts_anomaly_detection.sqlkapa.ai
11/03/2025, 8:07 PMkapa.ai
11/03/2025, 8:07 PMgenerate_schema_name macro in your dbt project that affects how Elementary creates its tables. ## The Issue Elementary is trying to find tables in platform.dummy_dbt.elementary_test_results (your default schema), but the tables were actually created in dummy_dbt_elementary (with the custom schema suffix). This mismatch happens because: 1. dbt commands use your custom generate_schema_name macro to create Elementary tables 2. edr commands look for tables based on the schema specified in your profiles.yml under the elementary profile, which doesn't respect your custom schema logic ## The Solution You need to exclude Elementary from your custom generate_schema_name macro. Here's how to fix it, as explained in [this Slack discussion](https://slack.com/archives/C02CTC89LAX/p1712851926036669): jinja {% macro generate_schema_name(custom_schema_name, node) -%} {% if node.package_name == 'elementary' %} {% set schema_name = node.package_name | trim %} {% else %} {# your existing custom logic here #} {% endif %} {{ schema_name }} {%- endmacro %} Or, if you want Elementary to follow dbt's default behavior while keeping your custom logic for other models: jinja {% macro generate_schema_name(custom_schema_name, node) -%} {% if node.package_name == 'elementary' and custom_schema_name %} {{ target.schema }}_{{ custom_schema_name | trim }} {% else %} {# your existing custom logic #} {% endif %} {%- endmacro %} ## Additional Configuration Make sure your profiles.yml has an elementary profile pointing to the correct schema where Elementary tables are actually created. Based on your error, it should be: yaml elementary: outputs: default: # ... other configs schema: dummy_dbt_elementary # or whatever schema Elementary tables are in After making these changes, run dbt run --select elementary again to recreate the Elementary models in the correct schema.Luiz Felipe Campos da Silva
11/03/2025, 8:12 PMkapa.ai
11/03/2025, 8:12 PMkapa.ai
11/03/2025, 8:13 PMgenerate_schema_name macro is correctly configured to create Elementary tables in dummy_dbt_elementary (since custom_schema_name is "elementary" and your macro appends it to the default schema). However, you need to ensure your profiles.yml reflects where the Elementary tables are actually created. ## The Problem Your profiles.yml currently has: yaml schema: dummy_dbt But Elementary tables are being created in dummy_dbt_elementary due to your custom macro logic. When edr commands run, they only use the profiles.yml configuration and don't respect your custom generate_schema_name macro, as explained in [this GitHub issue](https://github.com/elementary-data/elementary/issues/1462). ## The Solution You need to add a separate elementary profile in your profiles.yml that points to the actual schema where Elementary tables exist: yaml elementary: outputs: prod: type: databricks method: http catalog: platform schema: dummy_dbt_elementary # This should match where your tables are actually created # ... other connection details target: prod As shown in [this Slack discussion](https://slack.com/archives/C02CTC89LAX/p1726599930360009), the elementary profile should be a top-level profile (same indentation as your existing dbt profile). ## Alternative Approach If you want to exclude Elementary from your custom schema logic entirely, you could modify your macro to handle Elementary specifically: jinja {% macro default__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 }} {%- 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 %} After making these changes, run dbt run --select elementary to ensure the tables are in the correct location, and then your edr commands should work properly.Luiz Felipe Campos da Silva
11/03/2025, 11:10 PMelementary.handle_tests_results.
" elementary_test_results elementary models/edr/run_results/elementary_test_results.sql edr/run_results/elementary_test_results.sql elementary://models/run_results.yml 2025-11-03 175739 066f85350eb21c40078f633b674efbba id null null protected
model.elementary.dbt_source_freshness_results dbt_source_freshness_results fb063c8eb524356395464854c25d33038742ce2e0c3d4b3936ce8919a0ee27d6 incremental ["data_domain_layer_slug=plat", "owner_layer_slug=data-platform", "service_name=elementary-test"] {"timestamp_column": "created_at", "prev_timestamp_column": "generated_at"} [] platform dummy_dbt_elementary ["macro.elementary.empty_dbt_source_freshness_results", "macro.elementary.get_config_var", "macro.elementary.get_default_incremental_strategy", "macro.elementary.get_default_table_type"] [] dbt_source_freshness_results elementary models/edr/run_results/dbt_source_freshness_results.sql edr/run_results/dbt_source_freshness_results.sql null 2025-11-03 175739 a2279649167b401c130e34c05121b932 source_freshness_execution_id null null protectedkapa.ai
11/03/2025, 11:11 PMkapa.ai
11/03/2025, 11:11 PMdbt_models table, yes, Elementary does need to save information about its own models. This is expected behavior. ## Why Elementary Saves Its Own Model Information The dbt_models table is one of Elementary's metadata models that stores information about all models in your dbt project, including Elementary's own models. As explained in [this Slack discussion](https://slack.com/archives/C02CTC89LAX/p1673857363237629): > Metadata models (dbt_sources, dbt_models, etc) are regular tables, so we use truncate and insert to update to the current project state. This means that every time you run dbt run --select elementary, Elementary updates the dbt_models table with the current state of all models in your dbt project's manifest, which includes: - Your project's models (orders_daily, orders_raw) - Elementary's own models (elementary_test_results, dbt_source_freshness_results) ## Why This Is Necessary Elementary needs to track its own models because: 1. Complete lineage tracking: Elementary provides lineage and dependency tracking across your entire dbt project, including how its own models relate to your data 2. Metadata consistency: The dbt_models table reflects the complete state of your dbt project as captured in the manifest.json 3. Internal operations: Elementary uses this metadata for its monitoring and reporting features This is normal and expected behavior. The Elementary models you see in the dbt_models table are the ones created in your dummy_dbt_elementary schema, which is correct based on your configuration.