moose-lib 0.4.213__py3-none-any.whl → 0.4.215__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/dmv2.py +21 -8
- moose_lib/internal.py +2 -0
- {moose_lib-0.4.213.dist-info → moose_lib-0.4.215.dist-info}/METADATA +1 -1
- {moose_lib-0.4.213.dist-info → moose_lib-0.4.215.dist-info}/RECORD +6 -6
- {moose_lib-0.4.213.dist-info → moose_lib-0.4.215.dist-info}/WHEEL +0 -0
- {moose_lib-0.4.213.dist-info → moose_lib-0.4.215.dist-info}/top_level.txt +0 -0
moose_lib/dmv2.py
CHANGED
@@ -435,6 +435,7 @@ class IngestConfigWithDestination[T: BaseModel]:
|
|
435
435
|
metadata: Optional metadata for the ingestion configuration.
|
436
436
|
"""
|
437
437
|
destination: Stream[T]
|
438
|
+
dead_letter_queue: Optional[DeadLetterQueue[T]] = None
|
438
439
|
version: Optional[str] = None
|
439
440
|
metadata: Optional[dict] = None
|
440
441
|
|
@@ -456,6 +457,7 @@ class IngestPipelineConfig(BaseModel):
|
|
456
457
|
table: bool | OlapConfig = True
|
457
458
|
stream: bool | StreamConfig = True
|
458
459
|
ingest: bool | IngestConfig = True
|
460
|
+
dead_letter_queue: bool | StreamConfig = True
|
459
461
|
version: Optional[str] = None
|
460
462
|
metadata: Optional[dict] = None
|
461
463
|
|
@@ -504,6 +506,7 @@ class IngestPipeline(TypedMooseResource, Generic[T]):
|
|
504
506
|
table: The created `OlapTable` instance, if configured.
|
505
507
|
stream: The created `Stream` instance, if configured.
|
506
508
|
ingest_api: The created `IngestApi` instance, if configured.
|
509
|
+
dead_letter_queue: The created `DeadLetterQueue` instance, if configured.
|
507
510
|
columns (Columns[T]): Helper for accessing data field names safely.
|
508
511
|
name (str): The base name of the pipeline.
|
509
512
|
model_type (type[T]): The Pydantic model associated with this pipeline.
|
@@ -511,6 +514,7 @@ class IngestPipeline(TypedMooseResource, Generic[T]):
|
|
511
514
|
table: Optional[OlapTable[T]] = None
|
512
515
|
stream: Optional[Stream[T]] = None
|
513
516
|
ingest_api: Optional[IngestApi[T]] = None
|
517
|
+
dead_letter_queue: Optional[DeadLetterQueue[T]] = None
|
514
518
|
metadata: Optional[dict] = None
|
515
519
|
|
516
520
|
def get_table(self) -> OlapTable[T]:
|
@@ -574,6 +578,12 @@ class IngestPipeline(TypedMooseResource, Generic[T]):
|
|
574
578
|
stream_config.version = config.version
|
575
579
|
stream_config.metadata = stream_metadata
|
576
580
|
self.stream = Stream(name, stream_config, t=self._t)
|
581
|
+
if config.dead_letter_queue:
|
582
|
+
stream_config = StreamConfig() if config.dead_letter_queue is True else config.dead_letter_queue
|
583
|
+
if config.version:
|
584
|
+
stream_config.version = config.version
|
585
|
+
stream_config.metadata = stream_metadata
|
586
|
+
self.dead_letter_queue = DeadLetterQueue(f"{name}DeadLetterQueue", stream_config, t=self._t)
|
577
587
|
if config.ingest:
|
578
588
|
if self.stream is None:
|
579
589
|
raise ValueError("Ingest API needs a stream to write to.")
|
@@ -583,6 +593,8 @@ class IngestPipeline(TypedMooseResource, Generic[T]):
|
|
583
593
|
ingest_config_dict["destination"] = self.stream
|
584
594
|
if config.version:
|
585
595
|
ingest_config_dict["version"] = config.version
|
596
|
+
if self.dead_letter_queue:
|
597
|
+
ingest_config_dict["dead_letter_queue"] = self.dead_letter_queue
|
586
598
|
ingest_config_dict["metadata"] = ingest_metadata
|
587
599
|
ingest_config = IngestConfigWithDestination(**ingest_config_dict)
|
588
600
|
self.ingest_api = IngestApi(name, ingest_config, t=self._t)
|
@@ -707,13 +719,13 @@ class SqlResource:
|
|
707
719
|
pushes_data_to: list[Union[OlapTable, "SqlResource"]]
|
708
720
|
|
709
721
|
def __init__(
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
722
|
+
self,
|
723
|
+
name: str,
|
724
|
+
setup: list[str],
|
725
|
+
teardown: list[str],
|
726
|
+
pulls_data_from: Optional[list[Union[OlapTable, "SqlResource"]]] = None,
|
727
|
+
pushes_data_to: Optional[list[Union[OlapTable, "SqlResource"]]] = None,
|
728
|
+
metadata: dict = None
|
717
729
|
):
|
718
730
|
self.name = name
|
719
731
|
self.setup = setup
|
@@ -734,7 +746,8 @@ class View(SqlResource):
|
|
734
746
|
that this view depends on.
|
735
747
|
"""
|
736
748
|
|
737
|
-
def __init__(self, name: str, select_statement: str, base_tables: list[Union[OlapTable, SqlResource]],
|
749
|
+
def __init__(self, name: str, select_statement: str, base_tables: list[Union[OlapTable, SqlResource]],
|
750
|
+
metadata: dict = None):
|
738
751
|
setup = [
|
739
752
|
f"CREATE VIEW IF NOT EXISTS {name} AS {select_statement}".strip()
|
740
753
|
]
|
moose_lib/internal.py
CHANGED
@@ -110,6 +110,7 @@ class IngestApiConfig(BaseModel):
|
|
110
110
|
name: str
|
111
111
|
columns: List[Column]
|
112
112
|
write_to: Target
|
113
|
+
dead_letter_queue: Optional[str] = None
|
113
114
|
version: Optional[str] = None
|
114
115
|
metadata: Optional[dict] = None
|
115
116
|
|
@@ -306,6 +307,7 @@ def to_infra_map() -> dict:
|
|
306
307
|
name=api.config.destination.name
|
307
308
|
),
|
308
309
|
metadata=getattr(api, "metadata", None),
|
310
|
+
dead_letter_queue=api.config.dead_letter_queue.name
|
309
311
|
)
|
310
312
|
|
311
313
|
for name, api in _egress_apis.items():
|
@@ -3,8 +3,8 @@ moose_lib/blocks.py,sha256=_wdvC2NC_Y3MMEnB71WTgWbeQ--zPNHk19xjToJW0C0,3185
|
|
3
3
|
moose_lib/commons.py,sha256=BV5X78MuOWHiZV9bsWSN69JIvzTNWUi-gnuMiAtaO8A,2489
|
4
4
|
moose_lib/data_models.py,sha256=R6do1eQqHK6AZ4GTP5tOPtSZaltjZurfx9_Asji7Dwc,8529
|
5
5
|
moose_lib/dmv2-serializer.py,sha256=CL_Pvvg8tJOT8Qk6hywDNzY8MYGhMVdTOw8arZi3jng,49
|
6
|
-
moose_lib/dmv2.py,sha256=
|
7
|
-
moose_lib/internal.py,sha256=
|
6
|
+
moose_lib/dmv2.py,sha256=JFNRjTWUcuTw865Wy8E_UgjLeLZPWAU3m7Ec2rd3CKM,38404
|
7
|
+
moose_lib/internal.py,sha256=8aEXQjB2DWz-dGUJ0ch8g5awHxELoZx1XYmlVXlhCWo,14193
|
8
8
|
moose_lib/main.py,sha256=In-u7yA1FsLDeP_2bhIgBtHY_BkXaZqDwf7BxwyC21c,8471
|
9
9
|
moose_lib/query_param.py,sha256=AB5BKu610Ji-h1iYGMBZKfnEFqt85rS94kzhDwhWJnc,6288
|
10
10
|
moose_lib/tasks.py,sha256=6MXA0j7nhvQILAJVTQHCAsquwrSOi2zAevghAc_7kXs,1554
|
@@ -16,7 +16,7 @@ tests/__init__.py,sha256=0Gh4yzPkkC3TzBGKhenpMIxJcRhyrrCfxLSfpTZnPMQ,53
|
|
16
16
|
tests/conftest.py,sha256=ZVJNbnr4DwbcqkTmePW6U01zAzE6QD0kNAEZjPG1f4s,169
|
17
17
|
tests/test_moose.py,sha256=mBsx_OYWmL8ppDzL_7Bd7xR6qf_i3-pCIO3wm2iQNaA,2136
|
18
18
|
tests/test_redis_client.py,sha256=d9_MLYsJ4ecVil_jPB2gW3Q5aWnavxmmjZg2uYI3LVo,3256
|
19
|
-
moose_lib-0.4.
|
20
|
-
moose_lib-0.4.
|
21
|
-
moose_lib-0.4.
|
22
|
-
moose_lib-0.4.
|
19
|
+
moose_lib-0.4.215.dist-info/METADATA,sha256=wC9g0yXSs7JTDNGb_Ms_-8Dg7h24-Wzvl-MGjclBlfA,638
|
20
|
+
moose_lib-0.4.215.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
21
|
+
moose_lib-0.4.215.dist-info/top_level.txt,sha256=XEns2-4aCmGp2XjJAeEH9TAUcGONLnSLy6ycT9FSJh8,16
|
22
|
+
moose_lib-0.4.215.dist-info/RECORD,,
|
File without changes
|
File without changes
|