-
Notifications
You must be signed in to change notification settings - Fork 0
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-756] Stringify user-provided messages to {{ log() }} #1
base: main
Are you sure you want to change the base?
Conversation
@@ -43,7 +43,7 @@ def test__override_vars_global(self, project): | |||
|
|||
|
|||
# This one switches to setting a var in 'test' | |||
class TestCLIVarOverridePorject: | |||
class TestCLIVarOverrideProject: |
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.
This is a completely unrelated change to fix this typo. I'm curious what the culture is about bundling in tiny unrelated changes like this. Is it fine or is it expected to be broken out to a separate PR?
try: | ||
msg = str(msg) | ||
except Exception as e: | ||
raise RuntimeException("log failed to stringify the given object") from e |
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.
@@ -0,0 +1,55 @@ | |||
import pytest |
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.
Not sure if this is even the appropriate variation of test for this part of the codebase, I found this directory through randomly wandering, and then I copied adjacent files to get it to work.
@@ -11,6 +11,7 @@ | |||
from dbt.exceptions import ( | |||
CompilationException, | |||
MacroReturn, | |||
RuntimeException, |
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.
Is there a more specific/appropriate exception than RuntimeException
?
@@ -543,10 +544,11 @@ def zip_strict(*args: Iterable[Any]) -> Iterable[Any]: | |||
|
|||
@contextmember | |||
@staticmethod | |||
def log(msg: str, info: bool = False) -> str: | |||
def log(msg: Any, info: bool = False) -> str: |
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.
TODO: figure out / what is the workflow to get https://github.com/dbt-labs/docs.getdbt.com/blob/current/website/docs/reference/dbt-jinja-functions/log.md get updated from this?
d2bf298
to
eef4cb0
Compare
draft: I'm using this rather randomly selected task to explore the workflow of contributing to dbt-core
TODO: get CLA through figma legal
TODO: post PR against actual repo
TODO: the changie thing
resolves dbt-labs#5385
Description
Much more depth in the issue dbt-labs#5385. This PR fixes an issue wherein
log
errors in the scenario that{{ log(["this is something other than a string"]) }}
This PR implements the solution articulated in the issue and throws in a test case too.
Checklist
changie new
to create a changelog entry