TABLE_NOT_FOUND Error During Unit Testing in dbt-athena 1.8 Due to Jinja Macro Dependency #652
Open
2 tasks done
Labels
bug
Something isn't working
Is this a new bug in dbt-athena?
Current Behavior
I have configured dbt-athena 1.8 and I'm trying to run a unit test on a model article_sold that depends on a Jinja macro sale_start_date(). This macro relies on another model retail_calendar
The unit_test is defined in this way:
When I run the test, I get this error:
TABLE_NOT_FOUND: line 5:14: Table 'awsdatacatalog.dbt_default.__dbt__cte__retail_calendar' does not exist
It seems that the SQL Athena query for the sale_start_date() macro is not correctly generated when I run the unit test. In fact, if I simply run the model article_sold, the SQL generated for the same macro sale_start_date() is different compared to the SQL generated when I run the unit test on article_sold.
The SQL code that is generated from the models where the macro is correctly referenced:
When we lunch unit tests we get the wrong SQL:
In the second SQL the from is not correct.
Expected Behavior
I expected the unit test for the model article_sold to execute successfully, with the SQL query for the sale_start_date() macro correctly incorporating the dependent model retail_calendar. The expected behavior is that the test runs without errors and correctly validates the logic of the article_sold model based on the provided input data. This test wit postgress adapter works well but with dbt-athena-community 1.8.1 not.
Steps To Reproduce
Here are the steps to reproduce our issue.
We are using Athena and materializing the tables in Iceberg. We are working with two models, A and B, both written in Athena and Iceberg. We created a macro that is used from model A and macro reads from model B, but when we run it, we encounter dependency problems.
awsdatacatalog.dbt_default.__dbt__cte__retail_calendar' does not exist
Environment
Additional Context
No response
The text was updated successfully, but these errors were encountered: