@@ -1008,32 +1008,23 @@ def test_model_grants_engine_specific_bigquery() -> None:
10081008 assert grants_config ["select" ] == ["analyst@company.com" ]
10091009
10101010
1011- def test_ephemeral_model_with_global_grants (create_empty_project ):
1012- dbt_project_dir , dbt_model_dir = create_empty_project ()
1013-
1014- yaml = YAML ()
1015- dbt_project_config = {
1016- "name" : "test_project" ,
1017- "version" : "1.0.0" ,
1018- "config-version" : 2 ,
1019- "profile" : "test" ,
1020- "model-paths" : ["models" ],
1021- "models" : {"test_project" : {"grants" : {"select" : ["reporter" , "analyst" ]}}},
1022- }
1023- dbt_project_file = dbt_project_dir / "dbt_project.yml"
1024- with open (dbt_project_file , "w" , encoding = "utf-8" ) as f :
1025- yaml .dump (dbt_project_config , f )
1011+ def test_ephemeral_model_ignores_grants () -> None :
1012+ """Test that ephemeral models ignore grants configuration."""
1013+ model_config = ModelConfig (
1014+ name = "ephemeral_model" ,
1015+ sql = "SELECT 1 as id" ,
1016+ materialized = "ephemeral" ,
1017+ grants = {"select" : ["reporter" , "analyst" ]},
1018+ path = Path ("ephemeral_model.sql" ),
1019+ )
10261020
1027- ephemeral_model_sql = """
1028- {{ config(materialized='ephemeral') }}
1029- SELECT 1 as id
1030- """
1031- ephemeral_model_file = dbt_model_dir / "ephemeral_model.sql"
1032- with open (ephemeral_model_file , "w" , encoding = "utf-8" ) as f :
1033- f .write (ephemeral_model_sql )
1021+ context = DbtContext ()
1022+ context .project_name = "test_project"
1023+ context .target = DuckDbConfig (name = "target" , schema = "test_schema" )
10341024
1035- context = Context (paths = dbt_project_dir )
1036- model = context .get_model ('"local"."main"."ephemeral_model"' )
1025+ sqlmesh_model = model_config .to_sqlmesh (
1026+ context , virtual_environment_mode = VirtualEnvironmentMode .FULL
1027+ )
10371028
1038- assert model .kind .is_embedded
1039- assert model .grants is None # grants config is skipped for ephemeral / embedded models
1029+ assert sqlmesh_model .kind .is_embedded
1030+ assert sqlmesh_model .grants is None # grants config is skipped for ephemeral / embedded models
0 commit comments