moose-lib 0.4.165__py3-none-any.whl → 0.4.167__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
moose_lib/data_models.py CHANGED
@@ -17,11 +17,16 @@ type JWT[T] = T
17
17
  type Aggregated[T, agg_func] = Annotated[T, agg_func]
18
18
 
19
19
 
20
- @dataclasses.dataclass # a base model in the annotations will confuse pydantic
20
+ @dataclasses.dataclass # a BaseModel in the annotations will confuse pydantic
21
21
  class ClickhousePrecision:
22
22
  precision: int
23
23
 
24
24
 
25
+ @dataclasses.dataclass
26
+ class ClickhouseSize:
27
+ size: int
28
+
29
+
25
30
  def clickhouse_decimal(precision: int, scale: int) -> Type[Decimal]:
26
31
  return Annotated[Decimal, Field(max_digits=precision, decimal_places=scale)]
27
32
 
@@ -155,7 +160,13 @@ def py_type_to_column_type(t: type, mds: list[Any]) -> Tuple[bool, list[Any], Da
155
160
  else:
156
161
  data_type = f"DateTime({precision.precision})"
157
162
  elif t is date:
158
- data_type = "Date"
163
+ size = next((md for md in mds if isinstance(md, ClickhouseSize)), None)
164
+ if size is None or size.size == 4:
165
+ data_type = "Date"
166
+ elif size.size == 2:
167
+ data_type = "Date16"
168
+ else:
169
+ raise ValueError(f"Unsupported date size {size.size}")
159
170
  elif get_origin(t) is list:
160
171
  inner_optional, _, inner_type = py_type_to_column_type(get_args(t)[0], [])
161
172
  data_type = ArrayType(element_type=inner_type, element_nullable=inner_optional)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moose_lib
3
- Version: 0.4.165
3
+ Version: 0.4.167
4
4
  Home-page: https://www.fiveonefour.com/moose
5
5
  Author: Fiveonefour Labs Inc.
6
6
  Author-email: support@fiveonefour.com
@@ -1,7 +1,7 @@
1
1
  moose_lib/__init__.py,sha256=VYCFk9Nlakd24JPEj7h1cMIeqjp0eofnmE-3jCtPwXM,138
2
2
  moose_lib/blocks.py,sha256=_wdvC2NC_Y3MMEnB71WTgWbeQ--zPNHk19xjToJW0C0,3185
3
3
  moose_lib/commons.py,sha256=BV5X78MuOWHiZV9bsWSN69JIvzTNWUi-gnuMiAtaO8A,2489
4
- moose_lib/data_models.py,sha256=1U8IFQaO1hR8pNGb1UTtdcGQehGgKIvLNtUFFFXC1Ko,7695
4
+ moose_lib/data_models.py,sha256=IClXI6rBKUiR_h4R1eVCjJi8-jWhT0x3wCwScBAQ_XA,8025
5
5
  moose_lib/dmv2-serializer.py,sha256=CL_Pvvg8tJOT8Qk6hywDNzY8MYGhMVdTOw8arZi3jng,49
6
6
  moose_lib/dmv2.py,sha256=f3VsBYcTcWU1rEUjqG9cHcZxRUlXP_yBTbyoc7Tp7oI,31754
7
7
  moose_lib/internal.py,sha256=gREvC3XxBFN4i7JL5uMj0riCu_JUO2YyiMZvCokg1ME,13101
@@ -13,7 +13,7 @@ moose_lib/streaming/streaming_function_runner.py,sha256=K53lyzGLawAgKgrK3jreJrB7
13
13
  tests/__init__.py,sha256=0Gh4yzPkkC3TzBGKhenpMIxJcRhyrrCfxLSfpTZnPMQ,53
14
14
  tests/conftest.py,sha256=ZVJNbnr4DwbcqkTmePW6U01zAzE6QD0kNAEZjPG1f4s,169
15
15
  tests/test_moose.py,sha256=mBsx_OYWmL8ppDzL_7Bd7xR6qf_i3-pCIO3wm2iQNaA,2136
16
- moose_lib-0.4.165.dist-info/METADATA,sha256=UyELMJ-hz8afEjTeTLvRmHZbar6d2wbJn1-jTk30fwY,575
17
- moose_lib-0.4.165.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
18
- moose_lib-0.4.165.dist-info/top_level.txt,sha256=XEns2-4aCmGp2XjJAeEH9TAUcGONLnSLy6ycT9FSJh8,16
19
- moose_lib-0.4.165.dist-info/RECORD,,
16
+ moose_lib-0.4.167.dist-info/METADATA,sha256=HmdzbNUzuDfvTvQb5a9yoeQtqiLkQBwEGdKERStuMKs,575
17
+ moose_lib-0.4.167.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
18
+ moose_lib-0.4.167.dist-info/top_level.txt,sha256=XEns2-4aCmGp2XjJAeEH9TAUcGONLnSLy6ycT9FSJh8,16
19
+ moose_lib-0.4.167.dist-info/RECORD,,