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 #879

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

[Feature] Add TRUNCATE INSERT to materializations list #879

akmalsoliev opened this issue Jul 22, 2024 · 7 comments
Labels
enhancement New feature or 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 enhancement New feature or request triage labels Jul 22, 2024
@amychen1776
Copy link

@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 awaiting_response and removed enhancement New feature or request triage 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.

@amychen1776 amychen1776 added enhancement New feature or request and removed triage labels Aug 1, 2024
@amychen1776
Copy link

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

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants