File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -215,6 +215,14 @@ def _validate_partition_by(
215215 ):
216216 granularity = v ["granularity" ]
217217 raise ConfigError (f"Unexpected granularity '{ granularity } ' in partition_by '{ v } '." )
218+ if "data_type" in v and v ["data_type" ].lower () not in (
219+ "timestamp" ,
220+ "date" ,
221+ "datetime" ,
222+ "int64" ,
223+ ):
224+ data_type = v ["data_type" ]
225+ raise ConfigError (f"Unexpected data_type '{ data_type } ' in partition_by '{ v } '." )
218226 return {"data_type" : "date" , "granularity" : "day" , ** v }
219227 raise ConfigError (f"Invalid format for partition_by '{ v } '" )
220228
Original file line number Diff line number Diff line change @@ -1881,6 +1881,17 @@ def test_partition_by(sushi_test_project: Project):
18811881 )
18821882 assert model_config .to_sqlmesh (context ).partitioned_by == []
18831883
1884+ with pytest .raises (ConfigError , match = "Unexpected data_type 'string' in partition_by" ):
1885+ ModelConfig (
1886+ name = "model" ,
1887+ alias = "model" ,
1888+ schema = "test" ,
1889+ package_name = "package" ,
1890+ materialized = "table" ,
1891+ partition_by = {"field" : "ds" , "data_type" : "string" },
1892+ sql = """SELECT 1 AS one, ds FROM foo""" ,
1893+ )
1894+
18841895
18851896@pytest .mark .xdist_group ("dbt_manifest" )
18861897def test_partition_by_none (sushi_test_project : Project ):
You can’t perform that action at this time.
0 commit comments