Skip to content

Commit

Permalink
Ensure log() calls from jinja ensure the msg is stringified
Browse files Browse the repository at this point in the history
The simplest way to resolve [CT-2259](#7108)
and [CT-1783](#6568) in backports
to dbt-core < 1.4 is to ensure `msg` in `BaseContext.log()` is stringified.
  • Loading branch information
QMalcolm committed Apr 12, 2023
1 parent 355d177 commit 259d50b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/dbt/context/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,10 @@ def log(msg: str, info: bool = False) -> str:
{{ log("Running some_macro: " ~ arg1 ~ ", " ~ arg2) }}
{% endmacro %}"
"""

if not isinstance(msg, str):
msg = str(msg)

if info:
fire_event(MacroEventInfo(msg=msg))
else:
Expand Down

0 comments on commit 259d50b

Please sign in to comment.