@@ -870,3 +870,34 @@ def test_model_grants_engine_specific_bigquery() -> None:
870870 assert grants_config is not None
871871 assert grants_config ["bigquery.dataviewer" ] == ["user@domain.com" ]
872872 assert grants_config ["select" ] == ["analyst@company.com" ]
873+
874+
875+ def test_ephemeral_model_with_global_grants (create_empty_project ):
876+ dbt_project_dir , dbt_model_dir = create_empty_project ()
877+
878+ yaml = YAML ()
879+ dbt_project_config = {
880+ "name" : "test_project" ,
881+ "version" : "1.0.0" ,
882+ "config-version" : 2 ,
883+ "profile" : "test" ,
884+ "model-paths" : ["models" ],
885+ "models" : {"test_project" : {"grants" : {"select" : ["reporter" , "analyst" ]}}},
886+ }
887+ dbt_project_file = dbt_project_dir / "dbt_project.yml"
888+ with open (dbt_project_file , "w" , encoding = "utf-8" ) as f :
889+ yaml .dump (dbt_project_config , f )
890+
891+ ephemeral_model_sql = """
892+ {{ config(materialized='ephemeral') }}
893+ SELECT 1 as id
894+ """
895+ ephemeral_model_file = dbt_model_dir / "ephemeral_model.sql"
896+ with open (ephemeral_model_file , "w" , encoding = "utf-8" ) as f :
897+ f .write (ephemeral_model_sql )
898+
899+ context = Context (paths = dbt_project_dir )
900+ model = context .get_model ('"local"."main"."ephemeral_model"' )
901+
902+ assert model .kind .is_embedded
903+ assert model .grants is None # grants config is skipped for ephemeral / embedded models
0 commit comments