-
Notifications
You must be signed in to change notification settings - Fork 511
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 quote_identifiers
parameter to unpivot
to handle case-sensitive column names
#792
Merged
dbeatty10
merged 10 commits into
dbt-labs:main
from
error418:feat/unpivot-quote-columns
Jul 11, 2024
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
03467be
feat(unpivot): add quote identifier parameter to unpivot macro
error418 0115930
Merge branch 'main' into feat/unpivot-quote-columns
error418 740bc7b
Merge branch 'main' into feat/unpivot-quote-columns
error418 2b5e7a4
Merge branch 'main' into feat/unpivot-quote-columns
dbeatty10 6bf6b11
Changelog will be updated as part of release process
dbeatty10 07ba6a4
Enable test for unpivoting quoted columns for Redshift
dbeatty10 3e7b4ee
Fix warning related to `tests:` -> `data_tests:`
dbeatty10 02ba414
Simplify the case-sensitive unpivot test model
dbeatty10 cf6bfd8
Add a newline for consistency
dbeatty10 aa75ad7
Use mixed-case column names for all columns
dbeatty10 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Customer_Id,Created_At,sTaTuS,SEGMENT,Name | ||
123,2017-01-01,active,tier 1,name 1 | ||
234,2017-02-01,active,tier 3,name 3 | ||
567,2017-03-01,churned,tier 2,name 2 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Customer_Id,Created_At,Prop,Val | ||
123,"2017-01-01","SEGMENT","tier 1" | ||
123,"2017-01-01","sTaTuS","active" | ||
234,"2017-02-01","SEGMENT","tier 3" | ||
234,"2017-02-01","sTaTuS","active" | ||
567,"2017-03-01","sTaTuS","churned" | ||
567,"2017-03-01","SEGMENT","tier 2" |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
{{ dbt_utils.unpivot( | ||
relation=ref('data_unpivot_quote'), | ||
cast_to=type_string(), | ||
exclude=['Customer_Id', 'Created_At'], | ||
remove=['Name'], | ||
field_name='Prop', | ||
value_name='Val', | ||
quote_identifiers=True, | ||
) }} |
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
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.
In an ideal world, I would rather have the default be
quote_identifiers=True
so that it matches withpivot
. But agree with your choice here to default it toFalse
instead so we don't have any breaking behavior change.