moose-lib 0.6.125__tar.gz → 0.6.127__tar.gz

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.
Files changed (48) hide show
  1. {moose_lib-0.6.125 → moose_lib-0.6.127}/PKG-INFO +1 -1
  2. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/data_models.py +72 -0
  3. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib.egg-info/PKG-INFO +1 -1
  4. {moose_lib-0.6.125 → moose_lib-0.6.127}/README.md +0 -0
  5. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/__init__.py +0 -0
  6. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/blocks.py +0 -0
  7. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/clients/__init__.py +0 -0
  8. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/clients/redis_client.py +0 -0
  9. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/commons.py +0 -0
  10. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/config/__init__.py +0 -0
  11. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/config/config_file.py +0 -0
  12. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/config/runtime.py +0 -0
  13. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/dmv2/__init__.py +0 -0
  14. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/dmv2/_registry.py +0 -0
  15. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/dmv2/consumption.py +0 -0
  16. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/dmv2/ingest_api.py +0 -0
  17. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/dmv2/ingest_pipeline.py +0 -0
  18. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/dmv2/life_cycle.py +0 -0
  19. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/dmv2/materialized_view.py +0 -0
  20. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/dmv2/olap_table.py +0 -0
  21. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/dmv2/registry.py +0 -0
  22. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/dmv2/sql_resource.py +0 -0
  23. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/dmv2/stream.py +0 -0
  24. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/dmv2/types.py +0 -0
  25. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/dmv2/view.py +0 -0
  26. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/dmv2/workflow.py +0 -0
  27. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/dmv2_serializer.py +0 -0
  28. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/internal.py +0 -0
  29. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/main.py +0 -0
  30. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/query_builder.py +0 -0
  31. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/query_param.py +0 -0
  32. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/streaming/__init__.py +0 -0
  33. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/streaming/streaming_function_runner.py +0 -0
  34. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/utilities/__init__.py +0 -0
  35. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib/utilities/sql.py +0 -0
  36. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib.egg-info/SOURCES.txt +0 -0
  37. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib.egg-info/dependency_links.txt +0 -0
  38. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib.egg-info/requires.txt +0 -0
  39. {moose_lib-0.6.125 → moose_lib-0.6.127}/moose_lib.egg-info/top_level.txt +0 -0
  40. {moose_lib-0.6.125 → moose_lib-0.6.127}/setup.cfg +0 -0
  41. {moose_lib-0.6.125 → moose_lib-0.6.127}/setup.py +0 -0
  42. {moose_lib-0.6.125 → moose_lib-0.6.127}/tests/__init__.py +0 -0
  43. {moose_lib-0.6.125 → moose_lib-0.6.127}/tests/conftest.py +0 -0
  44. {moose_lib-0.6.125 → moose_lib-0.6.127}/tests/test_moose.py +0 -0
  45. {moose_lib-0.6.125 → moose_lib-0.6.127}/tests/test_olap_table_versioning.py +0 -0
  46. {moose_lib-0.6.125 → moose_lib-0.6.127}/tests/test_query_builder.py +0 -0
  47. {moose_lib-0.6.125 → moose_lib-0.6.127}/tests/test_redis_client.py +0 -0
  48. {moose_lib-0.6.125 → moose_lib-0.6.127}/tests/test_s3queue_config.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moose_lib
3
- Version: 0.6.125
3
+ Version: 0.6.127
4
4
  Home-page: https://www.fiveonefour.com/moose
5
5
  Author: Fiveonefour Labs Inc.
6
6
  Author-email: support@fiveonefour.com
@@ -48,6 +48,14 @@ def clickhouse_datetime64(precision: int) -> Type[datetime]:
48
48
  return Annotated[datetime, ClickhousePrecision(precision=precision)]
49
49
 
50
50
 
51
+ type Point = Annotated[tuple[float, float], "Point"]
52
+ type Ring = Annotated[list[tuple[float, float]], "Ring"]
53
+ type LineString = Annotated[list[tuple[float, float]], "LineString"]
54
+ type MultiLineString = Annotated[list[list[tuple[float, float]]], "MultiLineString"]
55
+ type Polygon = Annotated[list[list[tuple[float, float]]], "Polygon"]
56
+ type MultiPolygon = Annotated[list[list[list[tuple[float, float]]]], "MultiPolygon"]
57
+
58
+
51
59
  def aggregated[T](
52
60
  result_type: Type[T],
53
61
  agg_func: str,
@@ -153,6 +161,53 @@ class Column(BaseModel):
153
161
  return ColumnRef(self)
154
162
 
155
163
 
164
+ def _is_point_type(t: type) -> bool:
165
+ origin = get_origin(t)
166
+ if origin is tuple:
167
+ args = get_args(t)
168
+ return len(args) == 2 and all(arg is float for arg in args)
169
+ return False
170
+
171
+
172
+ def _is_list_of(inner_check: Any, t: type) -> bool:
173
+ origin = get_origin(t)
174
+ if origin is list:
175
+ args = get_args(t)
176
+ return len(args) == 1 and inner_check(args[0])
177
+ return False
178
+
179
+
180
+ def _validate_geometry_type(requested: str, t: type) -> None:
181
+ """
182
+ Validates that the provided Python type matches the expected structure
183
+ for the requested geometry annotation.
184
+ """
185
+ match requested:
186
+ case "Point":
187
+ if not _is_point_type(t):
188
+ raise ValueError("Point must be typed as tuple[float, float]")
189
+ case "Ring" | "LineString":
190
+ if not _is_list_of(_is_point_type, t):
191
+ raise ValueError(
192
+ f"{requested} must be typed as list[tuple[float, float]]"
193
+ )
194
+ case "MultiLineString" | "Polygon":
195
+ if not _is_list_of(lambda x: _is_list_of(_is_point_type, x), t):
196
+ raise ValueError(
197
+ f"{requested} must be typed as list[list[tuple[float, float]]]"
198
+ )
199
+ case "MultiPolygon":
200
+ if not _is_list_of(
201
+ lambda x: _is_list_of(lambda y: _is_list_of(_is_point_type, y), x),
202
+ t,
203
+ ):
204
+ raise ValueError(
205
+ "MultiPolygon must be typed as list[list[list[tuple[float, float]]]]"
206
+ )
207
+ case _:
208
+ raise ValueError(f"Unknown geometry type annotation: {requested}")
209
+
210
+
156
211
  def py_type_to_column_type(t: type, mds: list[Any]) -> Tuple[bool, list[Any], DataType]:
157
212
  # handle Annotated[Optional[Annotated[...], ...]
158
213
  t, mds = handle_annotation(t, mds)
@@ -213,6 +268,23 @@ def py_type_to_column_type(t: type, mds: list[Any]) -> Tuple[bool, list[Any], Da
213
268
  data_type = "IPv4"
214
269
  elif t is ipaddress.IPv6Address:
215
270
  data_type = "IPv6"
271
+ elif any(md in [ # this check has to happen before t is matched against tuple/list
272
+ "Point",
273
+ "Ring",
274
+ "LineString",
275
+ "MultiLineString",
276
+ "Polygon",
277
+ "MultiPolygon",
278
+ ] for md in mds):
279
+ data_type = next(md for md in mds if md in [
280
+ "Point",
281
+ "Ring",
282
+ "LineString",
283
+ "MultiLineString",
284
+ "Polygon",
285
+ "MultiPolygon",
286
+ ])
287
+ _validate_geometry_type(data_type, t)
216
288
  elif get_origin(t) is list:
217
289
  inner_optional, _, inner_type = py_type_to_column_type(get_args(t)[0], [])
218
290
  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.6.125
3
+ Version: 0.6.127
4
4
  Home-page: https://www.fiveonefour.com/moose
5
5
  Author: Fiveonefour Labs Inc.
6
6
  Author-email: support@fiveonefour.com
File without changes
File without changes
File without changes