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 6d8fd01 commit affdd73
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 @@ -456,6 +456,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))
else:
Expand Down

0 comments on commit affdd73

Please sign in to comment.