Neha Rastogi
05/05/2025, 2:37 PMkapa.ai
05/05/2025, 2:37 PMkapa.ai
05/05/2025, 2:37 PMdbt_project.yml looks like this: yaml elementary: +schema: "{% if (target.name == 'prod' or target.name == 'stage') %}observability{% endif %}" This means the schema will only be set to observability for the prod or stage targets. For other targets, the schema will be empty, which can cause tables to be created in a schema named None or similar, or not at all. Make sure you are running your dbt commands with the correct target (prod or stage) so that the schema is set properly. Otherwise, the tables may not be created where you expect them to be, or may not be created at all, resulting in empty tables or missing data [[source]](https://slack.com/archives/C02CTC89LAX/p1701110089154839). 2. profiles.yml Configuration Yes, you also need to ensure that your profiles.yml is set up correctly. For Elementary to work properly, you should have a separate profile for Elementary in your profiles.yml, matching the schema where the Elementary tables are created. For example: yaml your_dbt_profile: target: prod outputs: prod: # ... your dbt config ... schema: observability elementary: target: prod outputs: prod: # ... same config as above ... schema: observability This ensures that when you run Elementary CLI commands (like edr report), they look for the tables in the correct schema [[source]](https://slack.com/archives/C02CTC89LAX/p1736248012807089), [[source]](https://slack.com/archives/C02CTC89LAX/p1736248012807089). 3. Custom generate_schema_name Macro If you have overridden the generate_schema_name macro in your project, it can affect where the tables are created. If this macro does not handle the elementary models as expected, the tables may end up in the wrong schema. Double-check your macro logic to ensure it works for the elementary models as well [[source]](https://slack.com/archives/C02CTC89LAX/p1686812045836169), [[source]](https://slack.com/archives/C02CTC89LAX/p1678246556802279). 4. Running Commands on the Same Target Make sure you are running both dbt run --select elementary and dbt test with the same --target (e.g., --target prod). If you run them on different targets, the tables may not be created or populated as expected [[source]](https://slack.com/archives/C02CTC89LAX/p1683764076675589). Summary of steps to check: - Ensure your dbt run and dbt test commands use the correct target. - Make sure your profiles.yml has a matching profile for Elementary with the correct schema. - If you have a custom generate_schema_name macro, verify it works for Elementary models. - Confirm that the schema is not empty for your target in dbt_project.yml. If after these checks your tables are still empty, please share your profiles.yml and any custom macros for further troubleshooting.Noya Offer
05/06/2025, 11:36 AM