moose-lib 0.6.140__tar.gz → 0.6.142__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.
Potentially problematic release.
This version of moose-lib might be problematic. Click here for more details.
- {moose_lib-0.6.140 → moose_lib-0.6.142}/PKG-INFO +1 -1
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/data_models.py +13 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/dmv2/olap_table.py +6 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/internal.py +5 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib.egg-info/PKG-INFO +1 -1
- {moose_lib-0.6.140 → moose_lib-0.6.142}/README.md +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/__init__.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/blocks.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/clients/__init__.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/clients/redis_client.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/commons.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/config/__init__.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/config/config_file.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/config/runtime.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/dmv2/__init__.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/dmv2/_registry.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/dmv2/consumption.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/dmv2/ingest_api.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/dmv2/ingest_pipeline.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/dmv2/life_cycle.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/dmv2/materialized_view.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/dmv2/registry.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/dmv2/sql_resource.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/dmv2/stream.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/dmv2/types.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/dmv2/view.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/dmv2/web_app.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/dmv2/web_app_helpers.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/dmv2/workflow.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/dmv2_serializer.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/main.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/query_builder.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/query_param.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/streaming/__init__.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/streaming/streaming_function_runner.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/utilities/__init__.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib/utilities/sql.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib.egg-info/SOURCES.txt +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib.egg-info/dependency_links.txt +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib.egg-info/requires.txt +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/moose_lib.egg-info/top_level.txt +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/setup.cfg +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/setup.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/tests/__init__.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/tests/conftest.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/tests/test_moose.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/tests/test_olap_table_versioning.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/tests/test_query_builder.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/tests/test_redis_client.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/tests/test_s3queue_config.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/tests/test_simple_aggregate.py +0 -0
- {moose_lib-0.6.140 → moose_lib-0.6.142}/tests/test_web_app.py +0 -0
|
@@ -35,6 +35,11 @@ def clickhouse_default(expression: str) -> ClickhouseDefault:
|
|
|
35
35
|
return ClickhouseDefault(expression=expression)
|
|
36
36
|
|
|
37
37
|
|
|
38
|
+
@dataclasses.dataclass(frozen=True)
|
|
39
|
+
class ClickHouseTTL:
|
|
40
|
+
expression: str
|
|
41
|
+
|
|
42
|
+
|
|
38
43
|
def clickhouse_decimal(precision: int, scale: int) -> Type[Decimal]:
|
|
39
44
|
return Annotated[Decimal, Field(max_digits=precision, decimal_places=scale)]
|
|
40
45
|
|
|
@@ -194,6 +199,7 @@ class Column(BaseModel):
|
|
|
194
199
|
primary_key: bool
|
|
195
200
|
default: str | None = None
|
|
196
201
|
annotations: list[Tuple[str, Any]] = []
|
|
202
|
+
ttl: str | None = None
|
|
197
203
|
|
|
198
204
|
def to_expr(self):
|
|
199
205
|
# Lazy import to avoid circular dependency at import time
|
|
@@ -409,6 +415,12 @@ def _to_columns(model: type[BaseModel]) -> list[Column]:
|
|
|
409
415
|
None,
|
|
410
416
|
)
|
|
411
417
|
|
|
418
|
+
# Extract TTL expression from metadata, if provided
|
|
419
|
+
ttl_expr = next(
|
|
420
|
+
(md.expression for md in mds if isinstance(md, ClickHouseTTL)),
|
|
421
|
+
None,
|
|
422
|
+
)
|
|
423
|
+
|
|
412
424
|
columns.append(
|
|
413
425
|
Column(
|
|
414
426
|
name=column_name,
|
|
@@ -418,6 +430,7 @@ def _to_columns(model: type[BaseModel]) -> list[Column]:
|
|
|
418
430
|
primary_key=primary_key,
|
|
419
431
|
default=default_expr,
|
|
420
432
|
annotations=annotations,
|
|
433
|
+
ttl=ttl_expr,
|
|
421
434
|
)
|
|
422
435
|
)
|
|
423
436
|
return columns
|
|
@@ -112,6 +112,8 @@ class OlapConfig(BaseModel):
|
|
|
112
112
|
`order_by_expression="(id, name)"` is equivalent to order_by_fields=["id", "name"], or
|
|
113
113
|
"tuple()" for no sorting.
|
|
114
114
|
partition_by: Optional PARTITION BY expression (single ClickHouse SQL expression).
|
|
115
|
+
sample_by_expression: Optional SAMPLE BY expression for data sampling (single ClickHouse SQL expression).
|
|
116
|
+
Used to enable efficient approximate query processing with SAMPLE clause.
|
|
115
117
|
engine: The ClickHouse table engine to use. Can be either a ClickHouseEngines enum value
|
|
116
118
|
(for backward compatibility) or an EngineConfig instance (recommended).
|
|
117
119
|
version: Optional version string for tracking configuration changes.
|
|
@@ -123,11 +125,15 @@ class OlapConfig(BaseModel):
|
|
|
123
125
|
order_by_fields: list[str] = []
|
|
124
126
|
order_by_expression: Optional[str] = None
|
|
125
127
|
partition_by: Optional[str] = None
|
|
128
|
+
sample_by_expression: Optional[str] = None
|
|
126
129
|
engine: Optional[Union[ClickHouseEngines, EngineConfig]] = None
|
|
127
130
|
version: Optional[str] = None
|
|
128
131
|
metadata: Optional[dict] = None
|
|
129
132
|
life_cycle: Optional[LifeCycle] = None
|
|
130
133
|
settings: Optional[dict[str, str]] = None
|
|
134
|
+
# Optional table-level TTL expression (without leading 'TTL')
|
|
135
|
+
ttl: Optional[str] = None
|
|
136
|
+
|
|
131
137
|
# Optional secondary/data-skipping indexes
|
|
132
138
|
class TableIndex(BaseModel):
|
|
133
139
|
name: str
|
|
@@ -150,6 +150,7 @@ class TableConfig(BaseModel):
|
|
|
150
150
|
columns: List of columns with their types and attributes.
|
|
151
151
|
order_by: List of columns used for the ORDER BY clause.
|
|
152
152
|
partition_by: The column name used for the PARTITION BY clause.
|
|
153
|
+
sample_by_expression: Optional SAMPLE BY expression for data sampling.
|
|
153
154
|
engine_config: Engine configuration with type-safe, engine-specific parameters.
|
|
154
155
|
version: Optional version string of the table configuration.
|
|
155
156
|
metadata: Optional metadata for the table.
|
|
@@ -162,12 +163,14 @@ class TableConfig(BaseModel):
|
|
|
162
163
|
columns: List[Column]
|
|
163
164
|
order_by: List[str] | str
|
|
164
165
|
partition_by: Optional[str]
|
|
166
|
+
sample_by_expression: Optional[str] = None
|
|
165
167
|
engine_config: Optional[EngineConfigDict] = Field(None, discriminator='engine')
|
|
166
168
|
version: Optional[str] = None
|
|
167
169
|
metadata: Optional[dict] = None
|
|
168
170
|
life_cycle: Optional[str] = None
|
|
169
171
|
table_settings: Optional[dict[str, str]] = None
|
|
170
172
|
indexes: list[OlapConfig.TableIndex] = []
|
|
173
|
+
ttl: Optional[str] = None
|
|
171
174
|
|
|
172
175
|
|
|
173
176
|
class TopicConfig(BaseModel):
|
|
@@ -601,6 +604,7 @@ def to_infra_map() -> dict:
|
|
|
601
604
|
columns=table._column_list,
|
|
602
605
|
order_by=order_by_value,
|
|
603
606
|
partition_by=table.config.partition_by,
|
|
607
|
+
sample_by_expression=table.config.sample_by_expression,
|
|
604
608
|
engine_config=engine_config,
|
|
605
609
|
version=table.config.version,
|
|
606
610
|
metadata=getattr(table, "metadata", None),
|
|
@@ -608,6 +612,7 @@ def to_infra_map() -> dict:
|
|
|
608
612
|
# Map 'settings' to 'table_settings' for internal use
|
|
609
613
|
table_settings=table_settings if table_settings else None,
|
|
610
614
|
indexes=table.config.indexes,
|
|
615
|
+
ttl=table.config.ttl,
|
|
611
616
|
)
|
|
612
617
|
|
|
613
618
|
for name, stream in get_streams().items():
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|