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

[CT-656] [Feature] Allow for merge exclude columns #5260

Closed
1 task done
dave-connors-3 opened this issue May 17, 2022 · 1 comment · Fixed by #5457
Closed
1 task done

[CT-656] [Feature] Allow for merge exclude columns #5260

dave-connors-3 opened this issue May 17, 2022 · 1 comment · Fixed by #5457
Labels
enhancement New feature or request incremental Incremental modeling with dbt Team:Adapters Issues designated for the adapter area of the code

Comments

@dave-connors-3
Copy link
Contributor

Is this your first time opening an issue?

Describe the Feature

Right now, for incremental models using the merge strategy, we allow users to specify a specific list of merge_update_columns to include in the merge statement.

For wide, denormalized models, it's likely that users may want/need to exclude only a couple of columns, and update all the rest. Right now, this would require the user to manually specify a potentially long list of all columns that need to be updated, rather than a shorter, more straightforward list of columns not to update.

Once incremental materializations are simplified in the effort to create more streamlined materialization code, this seems like a simple quality of life enhancement!

Describe alternatives you've considered

Create a custom version of get_merge_sql to allow for an additional config merge_exclude_columns to achieve this behavior.

Who will this benefit?

This will be beneficial for users who have wide incremental models, and may need tight controls over the merge behavior on those tables.

Are you interested in contributing this feature?

heck yeah

Anything else?

This was mentioned in the original issue for merge_update_columns

@dave-connors-3 dave-connors-3 added enhancement New feature or request triage labels May 17, 2022
@github-actions github-actions bot changed the title [Feature] Allow for merge exclude columns [CT-656] [Feature] Allow for merge exclude columns May 17, 2022
@jtcohen6 jtcohen6 added incremental Incremental modeling with dbt Team:Adapters Issues designated for the adapter area of the code labels May 17, 2022
@jtcohen6 jtcohen6 added this to the v1.2 milestone May 20, 2022
@jtcohen6 jtcohen6 removed the triage label May 20, 2022
@jtcohen6
Copy link
Contributor

@dave-connors-3 Okay, I buy it :) thanks for opening to help us keep track of the request, since we've gotten it before!

The incremental materialization code is getting away from us, and I hesitate to add more complexity there in its current state. The good news is that we're soon to meaningfully refactor it, starting with incremental "strategies" in core and our adapter plugins. We're going to be freezing net-new code additions in the meantime. That should clear the path for a straightforward addition like this one, or like support for arbitrary incremental_predicates (#3293/#4546). At that point, this can be either a line of code that we write, or a good first issue. I can't guarantee that we ourselves will manage to do it before v1.2, but I'm adding it to the milestone anyway, if just to signal that we're on a linear path in its direction.

As discussed in #5215, I don't believe we should support or encourage any merge statement logic more complex than:

  • match criteria: unique_key, "lookback window" predicates to speed up performance
  • do update these columns with new data
  • don't update these columns with new data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request incremental Incremental modeling with dbt Team:Adapters Issues designated for the adapter area of the code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants