File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -1035,6 +1035,13 @@ def validate_definition(self) -> None:
10351035 # Will raise if the custom materialization points to an invalid class
10361036 get_custom_materialization_type_or_raise (self .kind .materialization )
10371037
1038+ # Embedded model kind shouldn't have audits
1039+ if self .kind .name == ModelKindName .EMBEDDED and self .audits :
1040+ raise_config_error (
1041+ "Audits are not supported for embedded models" ,
1042+ self ._path ,
1043+ )
1044+
10381045 def is_breaking_change (self , previous : Model ) -> t .Optional [bool ]:
10391046 """Determines whether this model is a breaking change in relation to the `previous` model.
10401047
Original file line number Diff line number Diff line change @@ -12158,3 +12158,19 @@ def test_grants_empty_values():
1215812158def test_grants_table_type (kind : t .Union [str , _ModelKind ], expected : DataObjectType ):
1215912159 model = create_sql_model ("test_table" , parse_one ("SELECT 1 as id" ), kind = kind )
1216012160 assert model .grants_table_type == expected
12161+
12162+
12163+ def test_audits_in_embedded_model ():
12164+ expression = d .parse (
12165+ """
12166+ MODEL (
12167+ name test.embedded_with_audits,
12168+ kind EMBEDDED,
12169+ audits (not_null (columns := (id)))
12170+ );
12171+
12172+ SELECT 1 AS id, 'A' as value
12173+ """
12174+ )
12175+ with pytest .raises (ConfigError , match = "Audits are not supported for embedded models" ):
12176+ load_sql_based_model (expression ).validate_definition ()
You can’t perform that action at this time.
0 commit comments