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

[Feature] Add TRUNCATE INSERT to materializations list #631

Open
3 tasks done
akmalsoliev opened this issue Jul 22, 2024 · 7 comments
Open
3 tasks done

[Feature] Add TRUNCATE INSERT to materializations list #631

akmalsoliev opened this issue Jul 22, 2024 · 7 comments
Labels
pkg:dbt-redshift Issue affects dbt-redshift type:enhancement New feature request

Comments

@akmalsoliev
Copy link

Is this your first time submitting a feature request?

  • I have read the expectations for open source contributors
  • I have searched the existing issues, and I could not find an existing issue for this feature
  • I am requesting a straightforward extension of existing dbt-redshift functionality, rather than a Big Idea better suited to a discussion

Describe the feature

Instead of creating a new table, the approach involves using a TRUNCATE operation followed by an INSERT to update the existing materialized tables, which already have predefined data types.

Describe alternatives you've considered

No response

Who will this benefit?

This feature benefits database administrators, data engineers, developers, business analysts, and organizations by efficiently updating large datasets in existing materialized tables without the need for creating new tables, ensuring data integrity and speeding up data refreshes and decision-making processes.

Are you interested in contributing this feature?

Yes

Anything else?

No response

@akmalsoliev akmalsoliev added type:enhancement New feature request triage:product In Product's queue labels Jul 22, 2024
@amychen1776
Copy link
Contributor

@akmalsoliev Does the delete+insert method for incremental materialization fit your use case here?https://docs.getdbt.com/docs/build/incremental-strategy#supported-incremental-strategies-by-adapter

@amychen1776 amychen1776 added triage:awaiting-response Awaiting a response from the reporter and removed type:enhancement New feature request triage:product In Product's queue labels Jul 25, 2024
@akmalsoliev
Copy link
Author

@amychen1776 Hello and sorry for a late reply. Using DELETE + INSERT is not ideal because it occasionally changes the predefined data type. For example, a VARCHAR(100) might unexpectedly become VARCHAR(250). This is not the desired behaviour; we want the operation to forcefully fail in such cases. I understand that this should not be happening, however, in practice this action occurred.
Additionally, DELETE + INSERT strategy is quite slow in comparison to TRUNCATE + INSERT.

@github-actions github-actions bot added triage:product In Product's queue and removed triage:awaiting-response Awaiting a response from the reporter labels Jul 28, 2024
@amychen1776 amychen1776 added type:enhancement New feature request and removed triage:product In Product's queue labels Aug 1, 2024
@amychen1776
Copy link
Contributor

amychen1776 commented Aug 1, 2024

Thank you for the clarification! That is odd that it would change the data type.
Unfortuantely at this time we are unable to prioritize this on our roadmap. I'm going to leave this issue open to continue to collect information through and additional feedback

@akmalsoliev
Copy link
Author

I don't mind making a PR, if you're open for a contribution

@amychen1776
Copy link
Contributor

A contribution will always be welcomed :)

@akmalsoliev
Copy link
Author

Hey @amychen1776 any tips and tricks on where to get started with this issue? I took a look around and it appears that most of the materialisation macros are located in dbt/include/redshift/macros/relations/materialized_view/, however, got stuck there with figuring on how to proceed.

@amychen1776
Copy link
Contributor

@akmalsoliev as a side note - I'm curious if this would help resolve your use case? dbt-labs/dbt-core#10672

@mikealfare mikealfare added the pkg:dbt-redshift Issue affects dbt-redshift label Jan 15, 2025
@mikealfare mikealfare transferred this issue from dbt-labs/dbt-redshift Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:dbt-redshift Issue affects dbt-redshift type:enhancement New feature request
Projects
None yet
Development

No branches or pull requests

3 participants