@@ -2898,7 +2898,15 @@ def my_model_2(context):
28982898 # no warning with valid kind dict
28992899 with patch .object (get_console (), "log_warning" ) as mock_logger :
29002900
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+ )
29022910 def my_model (context ):
29032911 pass
29042912
@@ -2907,11 +2915,33 @@ def my_model(context):
29072915 path = Path ("." ),
29082916 )
29092917
2910- assert isinstance (python_model .kind , FullKind )
2918+ assert isinstance (python_model .kind , IncrementalByTimeRangeKind )
29112919
29122920 assert not mock_logger .call_args
29132921
29142922
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+
29152945def test_python_model_decorator_col_descriptions () -> None :
29162946 # `columns` and `column_descriptions` column names are different cases, but name normalization makes both lower
29172947 @model ("col_descriptions" , columns = {"col" : "int" }, column_descriptions = {"COL" : "a column" })
0 commit comments