-
Notifications
You must be signed in to change notification settings - Fork 978
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
Add behavior change flag docs for adapter maintainers #6092
Merged
matthewshaver
merged 6 commits into
current
from
content/adapter-maintain-behavior-flags
Sep 19, 2024
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
aadc82b
add behavior change flag docs for adapter maintainers
mikealfare 6d644a7
add the dbt-core version that supports behavior flags
mikealfare cd9ecd4
Apply suggestions from code review
mikealfare e471589
Merge branch 'current' into content/adapter-maintain-behavior-flags
mikealfare d562142
Editorial changes
matthewshaver 9e56d9e
Merge branch 'current' into content/adapter-maintain-behavior-flags
matthewshaver File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't pepper the code with a bunch individual checks like it's a configuration. It should truly represent "a legacy way" and "a novel way".
The
dbt-redshift
example is a good one. Depending on whether we use the SDK or not, we either call the macro, or we call the SDK. We check the flag once.In more complicated scenarios this may not be possible. Take Iceberg support for example. We need to check the flag in
list relations
and we also need to check it when creating a table in thecreate table
macro. So we need to check it twice, there's really no way around that. But let's look at thecreate table
macro in particular. We should just have two versions of that macro, the legacy version without Iceberg and the novel way with Iceberg; these are gated by the flag. That's good.Using two completely different versions of the code will result in a lot of duplicated code though. Both versions need a name, they need to put the sql at the end, they have shared options like
warehouse
, etc. But there are multiple points where they differ as well. There are different config options likeexternal_volume
. One usescreate table my_table as...
and the other usescreate iceberg table my_table as...
. So there will be an intuitive push towards DRY code where you can embed a check inside the macro at each point where it differs. That's not good. The behavior flag is becoming part of the code, and can more easily contribute to bugs in the code, in particular in the legacy code which was supposed to be gated from this whole change in the first place.