-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Fix adapter failures due to string formatting issues #4305
Merged
Merged
Conversation
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
jtcohen6
approved these changes
Nov 18, 2021
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.
Nice catch!
Confirmed this fixed test_redshift_column_quotes
(one of the nightly failures) when I ran it locally with this branch
emmyoop
approved these changes
Nov 18, 2021
Comment on lines
+24
to
+47
def test_formatting(self): | ||
logger = AdapterLogger("dbt_tests") | ||
# tests that it doesn't throw | ||
logger.debug("hello {}", 'world') | ||
|
||
# enters lower in the call stack to test that it formats correctly | ||
event = AdapterEventDebug(name="dbt_tests", base_msg="hello {}", args=('world',)) | ||
self.assertTrue("hello world" in event.message()) | ||
|
||
# tests that it doesn't throw | ||
logger.debug("1 2 {}", 3) | ||
|
||
# enters lower in the call stack to test that it formats correctly | ||
event = AdapterEventDebug(name="dbt_tests", base_msg="1 2 {}", args=(3,)) | ||
self.assertTrue("1 2 3" in event.message()) | ||
|
||
# tests that it doesn't throw | ||
logger.debug("boop{x}boop") | ||
|
||
# enters lower in the call stack to test that it formats correctly | ||
# in this case it's that we didn't attempt to replace anything since there | ||
# were no args passed after the initial message | ||
event = AdapterEventDebug(name="dbt_tests", base_msg="boop{x}boop", args=()) | ||
self.assertTrue("boop{x}boop" in event.message()) |
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.
👍
iknox-fa
pushed a commit
that referenced
this pull request
Feb 8, 2022
fix adapter failures due to string formatting issues automatic commit by git-black, original commits: b4793b4
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This is an alternative solution to dbt-labs/dbt-redshift#43. Prior to this change, log messages passed to the AdapterLogger that had brackets in them would trigger a KeyError when we tried to format with an empty set of arguments. This solution is preferred to dbt-labs/dbt-redshift#43 because it fixes an existing interface problem.
Checklist
CHANGELOG.md
and added information about my change