Skip to content

Commit 359266f

Browse files
authored
Feat: Add @default_catalog to the macro environment (#1988)
* fix: qualify tables with default catalog in command nodes Command nodes like AlterTable are not operated in the scope operations in the sqlglot qualify tables op, nor should the necessariy be. But we want to do it here to give the renderer as much information as possible and to make post statements and pre statements more correct. * fix: pass default catalog to the render kwargs * fix: set default catalog in seemingly correct place
1 parent 91005ab commit 359266f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sqlmesh/core/macros.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@ def __init__(
121121
):
122122
self.dialect = dialect
123123
self.generator = MacroDialect().generator()
124-
self.locals: t.Dict[str, t.Any] = {"runtime_stage": runtime_stage.value}
124+
self.locals: t.Dict[str, t.Any] = {
125+
"runtime_stage": runtime_stage.value,
126+
"default_catalog": default_catalog,
127+
}
125128
self.env = {**ENV, "self": self}
126129
self.python_env = python_env or {}
127130
self._jinja_env: t.Optional[Environment] = jinja_env

0 commit comments

Comments
 (0)