You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Getting the following error when trying to run unit tests with model having a recursive CTE
Runtime Error
Database Error in model_example (tests/unit/model_example.sql)
WITH RECURSIVE is only allowed at the top level of the SELECT, CREATE TABLE AS SELECT, CREATE VIEW, INSERT, EXPORT DATA statements.
Within the generated test SQL, the recursive CTE is no longer at the top level which invalidates the query.
Is there a way to handle this?
The text was updated successfully, but these errors were encountered:
Hi @jameshorrocks001, I'm afraid this will be a tough one. 'dbt-unit-testing' relies heavily on CTEs and it's hard to make it work if you can only have recursive CTEs at the top level. Which database are you using?
Sorry for the late response. I'm afraid it's not possible right now to use recursive CTEs with dbt-unit-testing. Thank you very much for your comment; we'll try to think of a way to solve this.
We should note this as a limitation of our current approach.
Since we create a CTE for mocking purposes - the model under test will always be inside this top-level CTE.
Getting the following error when trying to run unit tests with model having a recursive CTE
Within the generated test SQL, the recursive CTE is no longer at the top level which invalidates the query.
Is there a way to handle this?
The text was updated successfully, but these errors were encountered: