-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] unit testing a recursive CTE fails #1178
Comments
ZIP file includes two SQL files and a YML file. |
Hey - thanks so much for opening! Since this is currently broken, we're going to remove that callout from our docs site. But I will sync with our engineers to see how we can fix this.
|
## What are you changing in this pull request and why? Recursion is not currently working for BigQuery (dbt-labs/dbt-bigquery#1178), so per @graciegoheen, remove this from the scenarios until it is resolved. ## Checklist - [x] Review the [Content style guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md) so my content adheres to these guidelines.
Just adding the reproducible example Harlan shared. I have a model I want to unit test:
I add a unit test:
|
It looks like
|
For implementation:
I'm not sure if it's possible to remove the |
Additionally, we also expect to be able to wrap the user-provided sql in a subquery when constructing the statement that unions actual and expected results for comparison here. It seems that being able to wrap the user-provided SQL in a subquery is an assumption held by the unit testing framework in multiple places currently. |
It looks like the dbt-unit-testing package also experiences this limitation, which is unsurprising given the CTE-based approach: EqualExperts/dbt-unit-testing#198 I think the only way to solve this generally is to use a seed-based strategy for ephemeral models, similar to what we'd need for being able to test incremental model upsert/merge logic: dbt-labs/dbt-core#8499 |
We're going to call this out as a known limitation for the 1.8 release. But this is something we will revisit for 1.9 as an outcome of dbt-labs/dbt-core#8499 |
Is this a new bug in dbt-bigquery?
Current Behavior
I'm trying to unit test a model with a recursive CTE (a use case specifically called out in the docs), but it's failing with this error in dbt Cloud:
Examining the generated code, I can confirm that it starts with
select * from (WITH RECURSIVE
.Expected Behavior
I expect to be able to use unit tests with recursive CTEs on BigQuery.
Steps To Reproduce
dbt build --select +recursive_cte+
Relevant log output
Environment
Additional Context
See also dbt Labs support ticket 64761.
The text was updated successfully, but these errors were encountered: