File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1862,7 +1862,7 @@ def _extract_blueprint_variables(
18621862) -> t .Dict [str , str ]:
18631863 if not blueprint :
18641864 return {}
1865- if isinstance (blueprint , exp .Paren ):
1865+ if isinstance (blueprint , ( exp .Paren , exp . PropertyEQ ) ):
18661866 blueprint = blueprint .unnest ()
18671867 return {blueprint .left .name : blueprint .right .sql (dialect = dialect )}
18681868 if isinstance (blueprint , (exp .Tuple , exp .Array )):
Original file line number Diff line number Diff line change @@ -8327,6 +8327,31 @@ def gen_blueprints(evaluator):
83278327 assert '"memory"."customer2"."some_table"' in ctx .models
83288328
83298329
8330+ def test_single_blueprint (tmp_path : Path ) -> None :
8331+ init_example_project (tmp_path , dialect = "duckdb" , template = ProjectTemplate .EMPTY )
8332+
8333+ single_blueprint = tmp_path / "models/single_blueprint.sql"
8334+ single_blueprint .parent .mkdir (parents = True , exist_ok = True )
8335+ single_blueprint .write_text (
8336+ """
8337+ MODEL (
8338+ name @single_blueprint.some_table,
8339+ kind FULL,
8340+ blueprints ((single_blueprint := bar))
8341+ );
8342+
8343+ SELECT 1 AS c
8344+ """
8345+ )
8346+
8347+ ctx = Context (
8348+ config = Config (model_defaults = ModelDefaultsConfig (dialect = "duckdb" )), paths = tmp_path
8349+ )
8350+
8351+ assert len (ctx .models ) == 1
8352+ assert '"memory"."bar"."some_table"' in ctx .models
8353+
8354+
83308355@time_machine .travel ("2020-01-01 00:00:00 UTC" )
83318356def test_dynamic_date_spine_model (assert_exp_eq ):
83328357 @macro ()
You can’t perform that action at this time.
0 commit comments