-
Notifications
You must be signed in to change notification settings - Fork 47
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 #568
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 (https://github.com/dbt-labs/dbt-bigquery/issues/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 |
* The first element of the result is the PID * Debug-level logging of high-level message + SQL * Using redshift_connector `cursor.fetchone()` returns `(<something>,)` * Use cursor to call `select pg_terminate_backend({pid})` directly rather than using the `SQLConnectionManager` --------- Co-authored-by: Mike Alfare <[email protected]>
* adding SSO support for redshift Committer: Abby Whittier <[email protected]> * ADAP-891: Support test results as views (#614) * implement store-failures-as tests * Use the PID to terminate the session (#568) * The first element of the result is the PID * Debug-level logging of high-level message + SQL * Using redshift_connector `cursor.fetchone()` returns `(<something>,)` * Use cursor to call `select pg_terminate_backend({pid})` directly rather than using the `SQLConnectionManager` --------- Co-authored-by: Mike Alfare <[email protected]> * added error checking for new optional user field * black formatting * move connection fixtures into the functional scope * add iam user creds to the test.env template * add test for database connection method * add iam user auth test * add IAM User auth test and second user auth method * changie * maintain existing behavior when not providing profile * add AWS IAM profile * pull in new env vars * fixed env vars refs for CI * move all repo vars to secrets * split out connect method by connection method and provided information * condition to produce just kwargs, consolidate connect method * update .format to f-strings * incorporate feedback from pr#630 * update kwargs logic flow * updates to make space for iam role * revert type on user * revert test case decorator * revert test case decorator * revert error message * add integration tests * make space for both iam user and iam role in testing * add role arn * naming * try supplying region for CI * add region to CI env * we can only support role credentials by profile * move iam user specific config out of iam and into iam user * add type annotations * move iam defaults out of iam user * add required params to test profiles * add required params to test profiles * simplify test files * add expected fields back in * split out unit test files * split out unit test files * add unit tests for iam role auth method * standardize names * allow for the default profile * add unit tests for iam role access * changie * changie --------- Co-authored-by: Abby Whittier <[email protected]> Co-authored-by: Doug Beatty <[email protected]> Co-authored-by: colin-rogers-dbt <[email protected]> Co-authored-by: Anders <[email protected]>
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: