diff --git a/sqlmesh/dbt/builtin.py b/sqlmesh/dbt/builtin.py index c4fe0540b7..8d48c4a77a 100644 --- a/sqlmesh/dbt/builtin.py +++ b/sqlmesh/dbt/builtin.py @@ -545,6 +545,7 @@ def create_builtin_globals( builtin_globals["run_started_at"] = jinja_globals.get("execution_dt") or now() builtin_globals["dbt"] = AttributeDict(builtin_globals) + builtin_globals["context"] = builtin_globals["dbt"] return {**builtin_globals, **jinja_globals} diff --git a/tests/dbt/test_transformation.py b/tests/dbt/test_transformation.py index b5de61031b..89e4bca154 100644 --- a/tests/dbt/test_transformation.py +++ b/tests/dbt/test_transformation.py @@ -1435,6 +1435,13 @@ def test_flags(sushi_test_project: Project): assert context.render("{{ flags.WHICH }}") == "parse" +@pytest.mark.xdist_group("dbt_manifest") +def test_context_namespace(sushi_test_project: Project): + context = sushi_test_project.context + + assert context.render("{{ context.flags.FULL_REFRESH }}") == "None" + + @pytest.mark.xdist_group("dbt_manifest") def test_relation(sushi_test_project: Project): context = sushi_test_project.context