File tree Expand file tree Collapse file tree 3 files changed +23
-2
lines changed
examples/sushi_dbt/models Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -42,8 +42,6 @@ models:
4242 columns :
4343 - name : waiter_id
4444 description : Waiter id
45- tests :
46- - not_null
4745 - name : ds
4846 description : Date
4947 - name : waiter_as_customer_by_day
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 @@ -12176,3 +12176,19 @@ def execution_date(evaluator):
1217612176 )
1217712177 model = load_sql_based_model (expressions )
1217812178 assert_exp_eq (model .render_query (), '''SELECT '1970-01-01' AS "col"''' )
12179+
12180+
12181+ def test_audits_in_embedded_model ():
12182+ expression = d .parse (
12183+ """
12184+ MODEL (
12185+ name test.embedded_with_audits,
12186+ kind EMBEDDED,
12187+ audits (not_null (columns := (id)))
12188+ );
12189+
12190+ SELECT 1 AS id, 'A' as value
12191+ """
12192+ )
12193+ with pytest .raises (ConfigError , match = "Audits are not supported for embedded models" ):
12194+ load_sql_based_model (expression ).validate_definition ()
You can’t perform that action at this time.
0 commit comments