Skip to content
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

Increment models with RECURSIVE cause syntax error #49

Closed
ccharlesgb opened this issue Dec 12, 2023 · 0 comments · Fixed by #51
Closed

Increment models with RECURSIVE cause syntax error #49

ccharlesgb opened this issue Dec 12, 2023 · 0 comments · Fixed by #51
Labels
bug Something isn't working prioritised We are actively working on this

Comments

@ccharlesgb
Copy link
Collaborator

Context

Caused by #45

When incremental models are dry runned they now check schema type compatibility with a merge statement. If the model SQL uses WITH RECURSIVE then this causes a syntax error because you cannot do:

MERGE INTO `table_ref`
AS (
WITH RECURSIVE ...
)

dbt does not have this problem because incremental models run in two stages, insert into _tmp and then merged so the recursive statement only exists with the CREATE OR REPLACE DDL rather than in the MERGE.

I can't see a way around this apart from not running the extra merge statement if WITH RECURSIVE is present in the SQL. You will lose some dry run safety but I think this is ok.

@ccharlesgb ccharlesgb added prioritised We are actively working on this bug Something isn't working labels Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working prioritised We are actively working on this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant