moose-lib 0.4.316__tar.gz → 0.4.317__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.

Files changed (43) hide show
  1. {moose_lib-0.4.316 → moose_lib-0.4.317}/PKG-INFO +1 -1
  2. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/dmv2/__init__.py +7 -0
  3. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/dmv2/ingest_pipeline.py +7 -2
  4. moose_lib-0.4.317/moose_lib/dmv2/life_cycle.py +32 -0
  5. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/dmv2/olap_table.py +3 -0
  6. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/dmv2/stream.py +3 -0
  7. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/internal.py +6 -0
  8. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib.egg-info/PKG-INFO +1 -1
  9. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib.egg-info/SOURCES.txt +1 -0
  10. {moose_lib-0.4.316 → moose_lib-0.4.317}/README.md +0 -0
  11. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/__init__.py +0 -0
  12. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/blocks.py +0 -0
  13. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/clients/__init__.py +0 -0
  14. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/clients/redis_client.py +0 -0
  15. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/commons.py +0 -0
  16. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/config/__init__.py +0 -0
  17. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/config/config_file.py +0 -0
  18. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/config/runtime.py +0 -0
  19. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/data_models.py +0 -0
  20. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/dmv2/_registry.py +0 -0
  21. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/dmv2/consumption.py +0 -0
  22. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/dmv2/ingest_api.py +0 -0
  23. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/dmv2/materialized_view.py +0 -0
  24. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/dmv2/registry.py +0 -0
  25. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/dmv2/sql_resource.py +0 -0
  26. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/dmv2/types.py +0 -0
  27. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/dmv2/view.py +0 -0
  28. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/dmv2/workflow.py +0 -0
  29. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/dmv2-serializer.py +0 -0
  30. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/main.py +0 -0
  31. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/query_param.py +0 -0
  32. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/streaming/__init__.py +0 -0
  33. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/streaming/streaming_function_runner.py +0 -0
  34. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib/tasks.py +0 -0
  35. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib.egg-info/dependency_links.txt +0 -0
  36. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib.egg-info/requires.txt +0 -0
  37. {moose_lib-0.4.316 → moose_lib-0.4.317}/moose_lib.egg-info/top_level.txt +0 -0
  38. {moose_lib-0.4.316 → moose_lib-0.4.317}/setup.cfg +0 -0
  39. {moose_lib-0.4.316 → moose_lib-0.4.317}/setup.py +0 -0
  40. {moose_lib-0.4.316 → moose_lib-0.4.317}/tests/__init__.py +0 -0
  41. {moose_lib-0.4.316 → moose_lib-0.4.317}/tests/conftest.py +0 -0
  42. {moose_lib-0.4.316 → moose_lib-0.4.317}/tests/test_moose.py +0 -0
  43. {moose_lib-0.4.316 → moose_lib-0.4.317}/tests/test_redis_client.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moose_lib
3
- Version: 0.4.316
3
+ Version: 0.4.317
4
4
  Home-page: https://www.fiveonefour.com/moose
5
5
  Author: Fiveonefour Labs Inc.
6
6
  Author-email: support@fiveonefour.com
@@ -68,6 +68,10 @@ from .workflow import (
68
68
  Workflow,
69
69
  )
70
70
 
71
+ from .life_cycle import (
72
+ LifeCycle,
73
+ )
74
+
71
75
  from .registry import (
72
76
  get_tables,
73
77
  get_table,
@@ -132,6 +136,9 @@ __all__ = [
132
136
  'WorkflowConfig',
133
137
  'Workflow',
134
138
 
139
+ # Lifecycle
140
+ 'LifeCycle',
141
+
135
142
  # Registry
136
143
  'get_tables',
137
144
  'get_table',
@@ -11,6 +11,7 @@ from .types import TypedMooseResource, T
11
11
  from .olap_table import OlapTable, OlapConfig
12
12
  from .stream import Stream, StreamConfig, DeadLetterQueue
13
13
  from .ingest_api import IngestApi, IngestConfig, IngestConfigWithDestination
14
+ from .life_cycle import LifeCycle
14
15
 
15
16
  class IngestPipelineConfig(BaseModel):
16
17
  """Configuration for creating a complete ingestion pipeline.
@@ -25,6 +26,7 @@ class IngestPipelineConfig(BaseModel):
25
26
  ingest: Configuration for the ingest API component.
26
27
  version: Optional version string applied to all created components.
27
28
  metadata: Optional metadata for the ingestion pipeline.
29
+ life_cycle: Determines how changes in code will propagate to the resources.
28
30
  """
29
31
  table: bool | OlapConfig = True
30
32
  stream: bool | StreamConfig = True
@@ -32,6 +34,7 @@ class IngestPipelineConfig(BaseModel):
32
34
  dead_letter_queue: bool | StreamConfig = True
33
35
  version: Optional[str] = None
34
36
  metadata: Optional[dict] = None
37
+ life_cycle: Optional[LifeCycle] = None
35
38
 
36
39
  class IngestPipeline(TypedMooseResource, Generic[T]):
37
40
  """Creates and configures a linked Table, Stream, and Ingest API pipeline.
@@ -120,13 +123,15 @@ class IngestPipeline(TypedMooseResource, Generic[T]):
120
123
  stream_metadata = config.metadata
121
124
  ingest_metadata = config.metadata
122
125
  if config.table:
123
- table_config = OlapConfig() if config.table is True else config.table
126
+ table_config = (config.table if isinstance(config.table, OlapConfig) else
127
+ OlapConfig(life_cycle=config.life_cycle))
124
128
  if config.version:
125
129
  table_config.version = config.version
126
130
  table_config.metadata = table_metadata
127
131
  self.table = OlapTable(name, table_config, t=self._t)
128
132
  if config.stream:
129
- stream_config = StreamConfig() if config.stream is True else config.stream
133
+ stream_config = (config.stream if isinstance(config.stream, StreamConfig) else
134
+ StreamConfig(life_cycle=config.life_cycle))
130
135
  if config.table and stream_config.destination is not None:
131
136
  raise ValueError("The destination of the stream should be the table created in the IngestPipeline")
132
137
  stream_config.destination = self.table
@@ -0,0 +1,32 @@
1
+ """
2
+ Lifecycle management definitions for Moose Data Model v2 (dmv2).
3
+
4
+ This module defines how Moose manages the lifecycle of database resources
5
+ when your code changes.
6
+ """
7
+ from enum import Enum
8
+
9
+ class LifeCycle(Enum):
10
+ """Defines how Moose manages the lifecycle of database resources when your code changes.
11
+
12
+ This enum controls the behavior when there are differences between your code definitions
13
+ and the actual database schema or structure.
14
+ """
15
+
16
+ FULLY_MANAGED = "FULLY_MANAGED"
17
+ """Full automatic management (default behavior).
18
+ Moose will automatically modify database resources to match your code definitions,
19
+ including potentially destructive operations like dropping columns or tables.
20
+ """
21
+
22
+ DELETION_PROTECTED = "DELETION_PROTECTED"
23
+ """Deletion-protected automatic management.
24
+ Moose will modify resources to match your code but will avoid destructive actions
25
+ such as dropping columns, or tables. Only additive changes are applied.
26
+ """
27
+
28
+ EXTERNALLY_MANAGED = "EXTERNALLY_MANAGED"
29
+ """External management - no automatic changes.
30
+ Moose will not modify the database resources. You are responsible for managing
31
+ the schema and ensuring it matches your code definitions manually.
32
+ """
@@ -16,6 +16,7 @@ from ..config.runtime import RuntimeClickHouseConfig
16
16
  from .types import TypedMooseResource, T
17
17
  from ._registry import _tables
18
18
  from ..data_models import Column, is_array_nested_type, is_nested_type, _to_columns
19
+ from .life_cycle import LifeCycle
19
20
 
20
21
  @dataclass
21
22
  class InsertOptions:
@@ -102,6 +103,7 @@ class OlapConfig(BaseModel):
102
103
  engine: The ClickHouse table engine to use (e.g., MergeTree, ReplacingMergeTree).
103
104
  version: Optional version string for tracking configuration changes.
104
105
  metadata: Optional metadata for the table.
106
+ life_cycle: Determines how changes in code will propagate to the resources.
105
107
  """
106
108
  order_by_fields: list[str] = []
107
109
  # equivalent to setting `engine=ClickHouseEngines.ReplacingMergeTree`
@@ -109,6 +111,7 @@ class OlapConfig(BaseModel):
109
111
  engine: Optional[ClickHouseEngines] = None
110
112
  version: Optional[str] = None
111
113
  metadata: Optional[dict] = None
114
+ life_cycle: Optional[LifeCycle] = None
112
115
 
113
116
  class OlapTable(TypedMooseResource, Generic[T]):
114
117
  """Represents an OLAP table (e.g., a ClickHouse table) typed with a Pydantic model.
@@ -13,6 +13,7 @@ from pydantic.alias_generators import to_camel
13
13
  from .types import TypedMooseResource, ZeroOrMany, T, U
14
14
  from .olap_table import OlapTable
15
15
  from ._registry import _streams
16
+ from .life_cycle import LifeCycle
16
17
 
17
18
  class StreamConfig(BaseModel):
18
19
  """Configuration for data streams (e.g., Redpanda topics).
@@ -23,12 +24,14 @@ class StreamConfig(BaseModel):
23
24
  destination: Optional `OlapTable` where stream messages should be automatically ingested.
24
25
  version: Optional version string for tracking configuration changes.
25
26
  metadata: Optional metadata for the stream.
27
+ life_cycle: Determines how changes in code will propagate to the resources.
26
28
  """
27
29
  parallelism: int = 1
28
30
  retention_period: int = 60 * 60 * 24 * 7 # 7 days
29
31
  destination: Optional[OlapTable[Any]] = None
30
32
  version: Optional[str] = None
31
33
  metadata: Optional[dict] = None
34
+ life_cycle: Optional[LifeCycle] = None
32
35
 
33
36
  class TransformConfig(BaseModel):
34
37
  """Configuration for stream transformations.
@@ -64,6 +64,7 @@ class TableConfig(BaseModel):
64
64
  engine: The name of the ClickHouse engine used.
65
65
  version: Optional version string of the table configuration.
66
66
  metadata: Optional metadata for the table.
67
+ life_cycle: Lifecycle management setting for the table.
67
68
  """
68
69
  model_config = model_config
69
70
 
@@ -74,6 +75,7 @@ class TableConfig(BaseModel):
74
75
  engine: Optional[str]
75
76
  version: Optional[str] = None
76
77
  metadata: Optional[dict] = None
78
+ life_cycle: Optional[str] = None
77
79
 
78
80
  class TopicConfig(BaseModel):
79
81
  """Internal representation of a stream/topic configuration for serialization.
@@ -90,6 +92,7 @@ class TopicConfig(BaseModel):
90
92
  has_multi_transform: Flag indicating if a multi-transform function is defined.
91
93
  consumers: List of consumers attached to this topic.
92
94
  metadata: Optional metadata for the topic.
95
+ life_cycle: Lifecycle management setting for the topic.
93
96
  """
94
97
  model_config = model_config
95
98
 
@@ -104,6 +107,7 @@ class TopicConfig(BaseModel):
104
107
  has_multi_transform: bool
105
108
  consumers: List[Consumer]
106
109
  metadata: Optional[dict] = None
110
+ life_cycle: Optional[str] = None
107
111
 
108
112
  class IngestApiConfig(BaseModel):
109
113
  """Internal representation of an Ingest API configuration for serialization.
@@ -274,6 +278,7 @@ def to_infra_map() -> dict:
274
278
  engine=None if engine is None else engine.value,
275
279
  version=table.config.version,
276
280
  metadata=getattr(table, "metadata", None),
281
+ life_cycle=table.config.life_cycle.value if table.config.life_cycle else None,
277
282
  )
278
283
 
279
284
  for name, stream in get_streams().items():
@@ -305,6 +310,7 @@ def to_infra_map() -> dict:
305
310
  has_multi_transform=stream._multipleTransformations is not None,
306
311
  consumers=consumers,
307
312
  metadata=getattr(stream, "metadata", None),
313
+ life_cycle=stream.config.life_cycle.value if stream.config.life_cycle else None,
308
314
  )
309
315
 
310
316
  for name, api in get_ingest_apis().items():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moose_lib
3
- Version: 0.4.316
3
+ Version: 0.4.317
4
4
  Home-page: https://www.fiveonefour.com/moose
5
5
  Author: Fiveonefour Labs Inc.
6
6
  Author-email: support@fiveonefour.com
@@ -24,6 +24,7 @@ moose_lib/dmv2/_registry.py
24
24
  moose_lib/dmv2/consumption.py
25
25
  moose_lib/dmv2/ingest_api.py
26
26
  moose_lib/dmv2/ingest_pipeline.py
27
+ moose_lib/dmv2/life_cycle.py
27
28
  moose_lib/dmv2/materialized_view.py
28
29
  moose_lib/dmv2/olap_table.py
29
30
  moose_lib/dmv2/registry.py
File without changes
File without changes
File without changes