-
Notifications
You must be signed in to change notification settings - Fork 59
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
[ADAP-939] [Bug] cannot reference permanent table from temporary table constraint
when running incremental model with a foreign key
#628
Labels
bug
Something isn't working
Comments
github-actions
bot
changed the title
[Bug]
[ADAP-939] [Bug] Oct 10, 2023
cannot reference permanent table from temporary table constraint
when running incremental model with a foreign keycannot reference permanent table from temporary table constraint
when running incremental model with a foreign key
@aranke verified a fix for Postgres in dbt-labs/dbt-core#8768 and then created this backlog ticket for Redshift. |
I think the fix for |
The original fix (dbt-labs/dbt-core#8022) was modified slightly in dbt-labs/dbt-core#8889 to still enforce the contract. |
nathaniel-may
added
support_rotation
and removed
refinement
Product or leadership input needed
labels
Feb 7, 2024
1 task
Ran into this issue today and created a PR to address #927 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Most of the content below is copy-pasted from @amardatar within dbt-labs/dbt-core#8022
Is this a new bug in dbt-redshift?
Current Behavior
When running an incremental model with contract enforced and a foreign key, the model will fail on subsequent updates.
Expected Behavior
The update should succeed without an error.
Steps To Reproduce
First run a statement like:
Then, given a
schema.yml
file:And a SQL file:
dbt will succeed on the first run, and subsequently fail with the error:
As per the error returned, the issue appears to be that while rendering a temporary table as part of the update, dbt will also render the foreign key constraint (which is not valid in the context of a temporary table). This leads to the above failure.
Relevant log output
No response
Environment
The text was updated successfully, but these errors were encountered: