8383 format_additive_change_msg ,
8484 AdditiveChangeError ,
8585)
86- from sqlmesh .utils .jinja import JinjaMacroRegistry , MacroReturnVal
86+ from sqlmesh .utils .jinja import MacroReturnVal
8787
8888if sys .version_info >= (3 , 12 ):
8989 from importlib import metadata
@@ -2685,9 +2685,7 @@ def _execute_materialization(
26852685 create_only : bool = False ,
26862686 ** kwargs : t .Any ,
26872687 ) -> None :
2688- from sqlmesh .dbt .builtin import create_builtin_globals
2689-
2690- jinja_macros = getattr (model , "jinja_macros" , JinjaMacroRegistry ())
2688+ jinja_macros = model .jinja_macros
26912689 existing_globals = jinja_macros .global_objs .copy ()
26922690
26932691 # For vdes we need to use the table, since we don't know the schema/table at parse time
@@ -2709,8 +2707,8 @@ def _execute_materialization(
27092707 "execution_dt" : kwargs .get ("execution_time" ),
27102708 }
27112709
2712- context = create_builtin_globals (
2713- jinja_macros = jinja_macros , jinja_globals = jinja_globals , engine_adapter = self .adapter
2710+ context = jinja_macros . _create_builtin_globals (
2711+ { " engine_adapter" : self .adapter , ** jinja_globals }
27142712 )
27152713
27162714 context .update (
@@ -2731,7 +2729,7 @@ def _execute_materialization(
27312729 try :
27322730 template .render (** context )
27332731 except MacroReturnVal as ret :
2734- # this is a succesful return from a macro call (dbt uses this list of Relations to update their relation cache)
2732+ # this is a successful return from a macro call (dbt uses this list of Relations to update their relation cache)
27352733 returned_relations = ret .value .get ("relations" , [])
27362734 logger .info (
27372735 f"Materialization { self .materialization_name } returned relations: { returned_relations } "
0 commit comments