@@ -2898,7 +2898,15 @@ def my_model_2(context):
2898
2898
# no warning with valid kind dict
2899
2899
with patch .object (get_console (), "log_warning" ) as mock_logger :
2900
2900
2901
- @model ("kind_valid_dict" , kind = dict (name = ModelKindName .FULL ), columns = {'"COL"' : "int" })
2901
+ @model (
2902
+ "kind_valid_dict" ,
2903
+ kind = dict (
2904
+ name = ModelKindName .INCREMENTAL_BY_TIME_RANGE ,
2905
+ time_column = "ds" ,
2906
+ auto_restatement_cron = "@hourly" ,
2907
+ ),
2908
+ columns = {'"ds"' : "date" , '"COL"' : "int" },
2909
+ )
2902
2910
def my_model (context ):
2903
2911
pass
2904
2912
@@ -2907,11 +2915,33 @@ def my_model(context):
2907
2915
path = Path ("." ),
2908
2916
)
2909
2917
2910
- assert isinstance (python_model .kind , FullKind )
2918
+ assert isinstance (python_model .kind , IncrementalByTimeRangeKind )
2911
2919
2912
2920
assert not mock_logger .call_args
2913
2921
2914
2922
2923
+ def test_python_model_decorator_auto_restatement_cron () -> None :
2924
+ @model (
2925
+ "auto_restatement_model" ,
2926
+ cron = "@daily" ,
2927
+ kind = dict (
2928
+ name = ModelKindName .INCREMENTAL_BY_TIME_RANGE ,
2929
+ time_column = "ds" ,
2930
+ auto_restatement_cron = "@hourly" ,
2931
+ ),
2932
+ columns = {'"ds"' : "date" , '"COL"' : "int" },
2933
+ )
2934
+ def my_model (context ):
2935
+ pass
2936
+
2937
+ python_model = model .get_registry ()["auto_restatement_model" ].model (
2938
+ module_path = Path ("." ),
2939
+ path = Path ("." ),
2940
+ )
2941
+
2942
+ assert python_model .auto_restatement_cron == "@hourly"
2943
+
2944
+
2915
2945
def test_python_model_decorator_col_descriptions () -> None :
2916
2946
# `columns` and `column_descriptions` column names are different cases, but name normalization makes both lower
2917
2947
@model ("col_descriptions" , columns = {"col" : "int" }, column_descriptions = {"COL" : "a column" })
0 commit comments