<@U08TJSHS77E> Hey guys, I am using `dbt-spark` wi...
# ask-elementary-ai
n
@Cristian Cepeda Hey guys, I am using
dbt-spark
with elementary, but the on-run-end hook is not working. I am seeing this issue: Missing Elementary models in 'None.{schema}'. Please run 'dbt run -s elementary --target dev', although the tables are created. Anyone has faced this before?
k
A message from kapa.ai
This issue—seeing "Missing Elementary models in 'None.{schema}'. Please run 'dbt run -s elementary --target dev'" with dbt-spark, even though the tables are created—has been reported by other users. Here are some key points and troubleshooting steps based on the knowledge sources: 1. Schema/Target Mismatch: This error often occurs when the Elementary models are created in one target/schema, but your dbt command (like
dbt test
) is running on a different target or schema. Double-check that both your
dbt run -s elementary
and subsequent dbt commands are using the same target and schema. If you have multiple targets, you need to run
dbt run -s elementary --target <your_target>
for each environment where you want the tables to exist. After the initial run, the hooks should work as expected on that target. This is confirmed in several threads and issues, including guidance to ensure the target matches between runs and tests [[Github Issue #830](https://github.com/elementary-data/elementary/issues/830)]. 2. None Schema Issue: The error message referencing
'None.{schema}'
suggests that dbt or Elementary is not picking up the correct schema from your configuration. This can happen due to misconfiguration in your
dbt_project.yml
or a custom
generate_schema_name
macro that doesn't handle external packages correctly. Review your
dbt_project.yml
and any custom macros to ensure they allow Elementary to use its configured schema [[Slack Thread](https://slack.com/archives/C02CTC89LAX/p1701110089154839)]. 3. Full Refresh: Sometimes, running a full refresh can resolve issues where models exist but are not recognized. Try running:
Copy code
dbt run -s elementary --full-refresh --target dev
This can help if there are incremental models or schema mismatches [[Slack Thread](https://slack.com/archives/C02CTC89LAX/p1702420274487159)]. 4. dbt-spark Compatibility: There have been reports of issues with the Spark adapter, particularly with the on-run-end hook and schema resolution. In some cases, users have had to drop and recreate the Elementary tables or adjust their macros to ensure compatibility [[Slack Thread](https://slack.com/archives/C02CTC89LAX/p1670326107972819)]. 5. Custom Macros: If you have a custom
generate_schema_name
macro, ensure it does not override or interfere with external packages like Elementary. You may need to adjust it to allow Elementary models to use their intended schema [[Slack Thread](https://slack.com/archives/C02CTC89LAX/p1674057818860019)]. Summary of steps to try: - Ensure the same target and schema are used for both
dbt run -s elementary
and your other dbt commands. - Check for custom macros that might override schema settings. - Try a full refresh of Elementary models. - If the issue persists, consider dropping and recreating the Elementary tables. If after these steps the issue remains, please share your
dbt_project.yml
, any custom macros, and the exact commands you are running for further troubleshooting. Let me know if you need more specific guidance!