Compare commits

...

2 Commits

Author SHA1 Message Date
Chenyu Li
7a618c8839 add changelog 2022-07-24 12:26:54 -07:00
Chenyu Li
3456de5fa2 remove env var to enable debug and add breakpoint 2022-07-24 12:21:25 -07:00
2 changed files with 21 additions and 10 deletions

View File

@@ -0,0 +1,7 @@
kind: Features
body: Add breakpoint() function and remove env var requirment to enable it
time: 2022-07-24T12:26:24.593183-07:00
custom:
Author: ChenyuLInx
Issue: "0"
PR: "5519"

View File

@@ -311,19 +311,23 @@ class BaseContext(metaclass=ContextMeta):
msg = f"Env var required but not provided: '{var}'" msg = f"Env var required but not provided: '{var}'"
raise_parsing_error(msg) raise_parsing_error(msg)
if os.environ.get("DBT_MACRO_DEBUGGING"):
@contextmember @contextmember
@staticmethod @staticmethod
def debug(): def debug(frame_level=3):
"""Enter a debugger at this line in the compiled jinja code.""" """Enter a debugger at this line in the compiled jinja code."""
import sys import sys
import ipdb # type: ignore import ipdb # type: ignore
frame = sys._getframe(3) frame = sys._getframe(frame_level)
ipdb.set_trace(frame) ipdb.set_trace(frame)
return "" return ""
@contextmember
@staticmethod
def breakpoint():
BaseContext.debug(frame_level=4)
@contextmember("return") @contextmember("return")
@staticmethod @staticmethod
def _return(data: Any) -> NoReturn: def _return(data: Any) -> NoReturn: