Skip to content

Commit

Permalink
fix exposures crashing with referencing questions with multiple varia…
Browse files Browse the repository at this point in the history
…bles (#226)
  • Loading branch information
kkuznets authored Feb 16, 2024
1 parent df6e280 commit 09675ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dbtmetabase/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,4 @@ def safe_description(text: Optional[str]) -> str:
Returns:
str: Sanitized string with escaped Jinja syntax.
"""
return re.sub(r"{{(.*)}}", r"(\1)", text or "")
return re.sub(r"{{(.*?)}}", r"(\1)", text or "")
4 changes: 4 additions & 0 deletions tests/test_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ def test_safe_description(self):
"Depends on\n\nQuestion { #2 }!",
safe_description("Depends on\n\nQuestion { #2 }!"),
)
self.assertEqual(
"(start_date) - cast((rolling_days))",
safe_description("{{start_date}} - cast({{rolling_days}})"),
)

def test_dump_yaml(self):
path = Path("tests") / "tmp" / "test_dump_yaml.yml"
Expand Down

0 comments on commit 09675ec

Please sign in to comment.