dagster-sling 0.26.7rc0__tar.gz → 0.26.8__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 dagster-sling might be problematic. Click here for more details.
- {dagster-sling-0.26.7rc0/dagster_sling.egg-info → dagster-sling-0.26.8}/PKG-INFO +1 -1
- {dagster-sling-0.26.7rc0 → dagster-sling-0.26.8}/dagster_sling/__init__.py +4 -0
- dagster-sling-0.26.8/dagster_sling/components/__init__.py +0 -0
- dagster-sling-0.26.8/dagster_sling/components/sling_replication_collection/__init__.py +0 -0
- dagster-sling-0.26.8/dagster_sling/components/sling_replication_collection/component.py +169 -0
- dagster-sling-0.26.8/dagster_sling/components/sling_replication_collection/scaffolder.py +13 -0
- dagster-sling-0.26.8/dagster_sling/version.py +1 -0
- {dagster-sling-0.26.7rc0 → dagster-sling-0.26.8/dagster_sling.egg-info}/PKG-INFO +1 -1
- {dagster-sling-0.26.7rc0 → dagster-sling-0.26.8}/dagster_sling.egg-info/SOURCES.txt +6 -1
- dagster-sling-0.26.8/dagster_sling.egg-info/entry_points.txt +2 -0
- {dagster-sling-0.26.7rc0 → dagster-sling-0.26.8}/dagster_sling.egg-info/requires.txt +1 -1
- {dagster-sling-0.26.7rc0 → dagster-sling-0.26.8}/setup.py +6 -1
- dagster-sling-0.26.7rc0/dagster_sling/version.py +0 -1
- {dagster-sling-0.26.7rc0 → dagster-sling-0.26.8}/LICENSE +0 -0
- {dagster-sling-0.26.7rc0 → dagster-sling-0.26.8}/MANIFEST.in +0 -0
- {dagster-sling-0.26.7rc0 → dagster-sling-0.26.8}/README.md +0 -0
- {dagster-sling-0.26.7rc0 → dagster-sling-0.26.8}/dagster_sling/asset_decorator.py +0 -0
- {dagster-sling-0.26.7rc0 → dagster-sling-0.26.8}/dagster_sling/asset_defs.py +0 -0
- {dagster-sling-0.26.7rc0 → dagster-sling-0.26.8}/dagster_sling/dagster_sling_translator.py +0 -0
- {dagster-sling-0.26.7rc0 → dagster-sling-0.26.8}/dagster_sling/py.typed +0 -0
- {dagster-sling-0.26.7rc0 → dagster-sling-0.26.8}/dagster_sling/resources.py +0 -0
- {dagster-sling-0.26.7rc0 → dagster-sling-0.26.8}/dagster_sling/sling_event_iterator.py +0 -0
- {dagster-sling-0.26.7rc0 → dagster-sling-0.26.8}/dagster_sling/sling_replication.py +0 -0
- {dagster-sling-0.26.7rc0 → dagster-sling-0.26.8}/dagster_sling.egg-info/dependency_links.txt +0 -0
- {dagster-sling-0.26.7rc0 → dagster-sling-0.26.8}/dagster_sling.egg-info/not-zip-safe +0 -0
- {dagster-sling-0.26.7rc0 → dagster-sling-0.26.8}/dagster_sling.egg-info/top_level.txt +0 -0
- {dagster-sling-0.26.7rc0 → dagster-sling-0.26.8}/integration.yaml +0 -0
- {dagster-sling-0.26.7rc0 → dagster-sling-0.26.8}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dagster-sling
|
|
3
|
-
Version: 0.26.
|
|
3
|
+
Version: 0.26.8
|
|
4
4
|
Summary: Package for performing ETL/ELT tasks with Sling in Dagster.
|
|
5
5
|
Home-page: https://github.com/dagster-io/dagster/tree/master/python_modules/libraries/dagster-sling
|
|
6
6
|
Author: Dagster Labs
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
from dagster_shared.libraries import DagsterLibraryRegistry
|
|
2
2
|
|
|
3
3
|
from dagster_sling.asset_decorator import sling_assets
|
|
4
|
+
from dagster_sling.components.sling_replication_collection.component import (
|
|
5
|
+
SlingReplicationCollectionComponent,
|
|
6
|
+
)
|
|
4
7
|
from dagster_sling.dagster_sling_translator import DagsterSlingTranslator
|
|
5
8
|
from dagster_sling.resources import SlingConnectionResource, SlingMode, SlingResource
|
|
6
9
|
from dagster_sling.sling_replication import SlingReplicationParam
|
|
@@ -10,6 +13,7 @@ __all__ = [
|
|
|
10
13
|
"DagsterSlingTranslator",
|
|
11
14
|
"SlingConnectionResource",
|
|
12
15
|
"SlingMode",
|
|
16
|
+
"SlingReplicationCollectionComponent",
|
|
13
17
|
"SlingReplicationParam",
|
|
14
18
|
"SlingResource",
|
|
15
19
|
"sling_assets",
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
from collections.abc import Iterator, Mapping, Sequence
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Annotated, Any, Literal, Optional, Union
|
|
5
|
+
|
|
6
|
+
from dagster._core.definitions.asset_spec import AssetSpec
|
|
7
|
+
from dagster._core.definitions.assets import AssetsDefinition
|
|
8
|
+
from dagster._core.definitions.declarative_automation.automation_condition import (
|
|
9
|
+
AutomationCondition,
|
|
10
|
+
)
|
|
11
|
+
from dagster._core.definitions.definitions_class import Definitions
|
|
12
|
+
from dagster._core.definitions.events import AssetMaterialization
|
|
13
|
+
from dagster._core.definitions.result import MaterializeResult
|
|
14
|
+
from dagster.components import Resolvable, Resolver
|
|
15
|
+
from dagster.components.component.component import Component
|
|
16
|
+
from dagster.components.core.context import ComponentLoadContext
|
|
17
|
+
from dagster.components.resolved.context import ResolutionContext
|
|
18
|
+
from dagster.components.resolved.core_models import AssetAttributesModel, AssetPostProcessor, OpSpec
|
|
19
|
+
from dagster.components.scaffold.scaffold import scaffold_with
|
|
20
|
+
from dagster.components.utils import TranslatorResolvingInfo
|
|
21
|
+
from typing_extensions import TypeAlias
|
|
22
|
+
|
|
23
|
+
from dagster_sling.asset_decorator import sling_assets
|
|
24
|
+
from dagster_sling.components.sling_replication_collection.scaffolder import (
|
|
25
|
+
SlingReplicationComponentScaffolder,
|
|
26
|
+
)
|
|
27
|
+
from dagster_sling.dagster_sling_translator import DagsterSlingTranslator
|
|
28
|
+
from dagster_sling.resources import AssetExecutionContext, SlingResource
|
|
29
|
+
|
|
30
|
+
SlingMetadataAddons: TypeAlias = Literal["column_metadata", "row_count"]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class DagsterSlingTranslatorAutomationCondition(DagsterSlingTranslator):
|
|
34
|
+
"""Subclassed to pull in any overridden impl for get_automation_condition
|
|
35
|
+
into produced asset specs.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
def get_automation_condition(
|
|
39
|
+
self, stream_definition: Mapping[str, Any]
|
|
40
|
+
) -> Optional[AutomationCondition]: ...
|
|
41
|
+
|
|
42
|
+
def get_asset_spec(self, stream_definition: Mapping[str, Any]) -> AssetSpec:
|
|
43
|
+
asset_spec = super().get_asset_spec(stream_definition)
|
|
44
|
+
return asset_spec.replace_attributes(
|
|
45
|
+
automation_condition=self.get_automation_condition(stream_definition)
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class ComponentsDagsterSlingTranslator(DagsterSlingTranslator):
|
|
50
|
+
def __init__(self, *, resolving_info: TranslatorResolvingInfo):
|
|
51
|
+
super().__init__()
|
|
52
|
+
self.resolving_info = resolving_info
|
|
53
|
+
|
|
54
|
+
def get_asset_spec(self, obj: Any) -> AssetSpec: # pyright: ignore[reportIncompatibleMethodOverride]
|
|
55
|
+
base_spec = super().get_asset_spec(obj)
|
|
56
|
+
return self.resolving_info.get_asset_spec(
|
|
57
|
+
base_spec,
|
|
58
|
+
{self.resolving_info.obj_name: obj, "spec": base_spec},
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def resolve_translator(
|
|
63
|
+
context: ResolutionContext,
|
|
64
|
+
asset_attributes,
|
|
65
|
+
) -> DagsterSlingTranslator:
|
|
66
|
+
# TODO: Consider supporting owners and code_version in the future
|
|
67
|
+
if asset_attributes and isinstance(asset_attributes, AssetAttributesModel):
|
|
68
|
+
set_vals = asset_attributes.model_dump(exclude_unset=True)
|
|
69
|
+
if "owners" in set_vals:
|
|
70
|
+
raise ValueError("owners are not supported for sling_replication_collection component")
|
|
71
|
+
if "code_version" in set_vals:
|
|
72
|
+
raise ValueError(
|
|
73
|
+
"code_version is not supported for sling_replication_collection component"
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
return ComponentsDagsterSlingTranslator(
|
|
77
|
+
resolving_info=TranslatorResolvingInfo(
|
|
78
|
+
"stream_definition",
|
|
79
|
+
asset_attributes or AssetAttributesModel(),
|
|
80
|
+
context,
|
|
81
|
+
)
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@dataclass
|
|
86
|
+
class SlingReplicationSpecModel(Resolvable):
|
|
87
|
+
path: str
|
|
88
|
+
op: Optional[OpSpec] = None
|
|
89
|
+
translator: Annotated[
|
|
90
|
+
Optional[DagsterSlingTranslator],
|
|
91
|
+
Resolver(
|
|
92
|
+
resolve_translator,
|
|
93
|
+
model_field_name="asset_attributes",
|
|
94
|
+
model_field_type=Union[str, AssetAttributesModel],
|
|
95
|
+
),
|
|
96
|
+
] = None
|
|
97
|
+
include_metadata: list[SlingMetadataAddons] = field(default_factory=list)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def resolve_resource(
|
|
101
|
+
context: ResolutionContext,
|
|
102
|
+
sling,
|
|
103
|
+
) -> SlingResource:
|
|
104
|
+
return SlingResource(**context.resolve_value(sling.model_dump())) if sling else SlingResource()
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
@scaffold_with(SlingReplicationComponentScaffolder)
|
|
108
|
+
@dataclass
|
|
109
|
+
class SlingReplicationCollectionComponent(Component, Resolvable):
|
|
110
|
+
"""Expose one or more Sling replications to Dagster as assets.
|
|
111
|
+
|
|
112
|
+
[Sling](https://slingdata.io/) is a Powerful Data Integration tool enabling seamless ELT
|
|
113
|
+
operations as well as quality checks across files, databases, and storage systems.
|
|
114
|
+
|
|
115
|
+
dg scaffold component dagster_sling.SlingReplicationCollectionComponent {component_name} to get started.
|
|
116
|
+
|
|
117
|
+
This will create a component.yaml as well as a `replication.yaml` which is a Sling-specific configuration
|
|
118
|
+
file. See Sling's [documentation](https://docs.slingdata.io/concepts/replication#overview) on `replication.yaml`.
|
|
119
|
+
"""
|
|
120
|
+
|
|
121
|
+
resource: Annotated[
|
|
122
|
+
SlingResource,
|
|
123
|
+
Resolver(
|
|
124
|
+
resolve_resource,
|
|
125
|
+
model_field_name="sling",
|
|
126
|
+
),
|
|
127
|
+
] = field(default_factory=SlingResource)
|
|
128
|
+
replications: Sequence[SlingReplicationSpecModel] = field(default_factory=list)
|
|
129
|
+
asset_post_processors: Optional[Sequence[AssetPostProcessor]] = None
|
|
130
|
+
|
|
131
|
+
def build_asset(
|
|
132
|
+
self, context: ComponentLoadContext, replication_spec_model: SlingReplicationSpecModel
|
|
133
|
+
) -> AssetsDefinition:
|
|
134
|
+
op_spec = replication_spec_model.op or OpSpec()
|
|
135
|
+
|
|
136
|
+
@sling_assets(
|
|
137
|
+
name=op_spec.name or Path(replication_spec_model.path).stem,
|
|
138
|
+
op_tags=op_spec.tags,
|
|
139
|
+
replication_config=context.path / replication_spec_model.path,
|
|
140
|
+
dagster_sling_translator=replication_spec_model.translator,
|
|
141
|
+
backfill_policy=op_spec.backfill_policy,
|
|
142
|
+
)
|
|
143
|
+
def _asset(context: AssetExecutionContext):
|
|
144
|
+
yield from self.execute(
|
|
145
|
+
context=context, sling=self.resource, replication_spec_model=replication_spec_model
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
return _asset
|
|
149
|
+
|
|
150
|
+
def execute(
|
|
151
|
+
self,
|
|
152
|
+
context: AssetExecutionContext,
|
|
153
|
+
sling: SlingResource,
|
|
154
|
+
replication_spec_model: SlingReplicationSpecModel,
|
|
155
|
+
) -> Iterator[Union[AssetMaterialization, MaterializeResult]]:
|
|
156
|
+
iterator = sling.replicate(context=context)
|
|
157
|
+
if "column_metadata" in replication_spec_model.include_metadata:
|
|
158
|
+
iterator = iterator.fetch_column_metadata()
|
|
159
|
+
if "row_count" in replication_spec_model.include_metadata:
|
|
160
|
+
iterator = iterator.fetch_row_count()
|
|
161
|
+
yield from iterator
|
|
162
|
+
|
|
163
|
+
def build_defs(self, context: ComponentLoadContext) -> Definitions:
|
|
164
|
+
defs = Definitions(
|
|
165
|
+
assets=[self.build_asset(context, replication) for replication in self.replications],
|
|
166
|
+
)
|
|
167
|
+
for post_processor in self.asset_post_processors or []:
|
|
168
|
+
defs = post_processor(defs)
|
|
169
|
+
return defs
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
import yaml
|
|
4
|
+
from dagster.components.component.component_scaffolder import Scaffolder, ScaffoldRequest
|
|
5
|
+
from dagster.components.component_scaffolding import scaffold_component
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class SlingReplicationComponentScaffolder(Scaffolder):
|
|
9
|
+
def scaffold(self, request: ScaffoldRequest, params: Any) -> None:
|
|
10
|
+
scaffold_component(request, {"replications": [{"path": "replication.yaml"}]})
|
|
11
|
+
replication_path = request.target_path / "replication.yaml"
|
|
12
|
+
with open(replication_path, "w") as f:
|
|
13
|
+
yaml.dump({"source": {}, "target": {}, "streams": {}}, f)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.26.8"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dagster-sling
|
|
3
|
-
Version: 0.26.
|
|
3
|
+
Version: 0.26.8
|
|
4
4
|
Summary: Package for performing ETL/ELT tasks with Sling in Dagster.
|
|
5
5
|
Home-page: https://github.com/dagster-io/dagster/tree/master/python_modules/libraries/dagster-sling
|
|
6
6
|
Author: Dagster Labs
|
|
@@ -16,6 +16,11 @@ dagster_sling/version.py
|
|
|
16
16
|
dagster_sling.egg-info/PKG-INFO
|
|
17
17
|
dagster_sling.egg-info/SOURCES.txt
|
|
18
18
|
dagster_sling.egg-info/dependency_links.txt
|
|
19
|
+
dagster_sling.egg-info/entry_points.txt
|
|
19
20
|
dagster_sling.egg-info/not-zip-safe
|
|
20
21
|
dagster_sling.egg-info/requires.txt
|
|
21
|
-
dagster_sling.egg-info/top_level.txt
|
|
22
|
+
dagster_sling.egg-info/top_level.txt
|
|
23
|
+
dagster_sling/components/__init__.py
|
|
24
|
+
dagster_sling/components/sling_replication_collection/__init__.py
|
|
25
|
+
dagster_sling/components/sling_replication_collection/component.py
|
|
26
|
+
dagster_sling/components/sling_replication_collection/scaffolder.py
|
|
@@ -34,7 +34,7 @@ setup(
|
|
|
34
34
|
include_package_data=True,
|
|
35
35
|
python_requires=">=3.9,<3.13",
|
|
36
36
|
install_requires=[
|
|
37
|
-
"dagster==1.10.
|
|
37
|
+
"dagster==1.10.8",
|
|
38
38
|
"sling>=1.1.5",
|
|
39
39
|
# Required due to a bug in uv that can cause sling-linux-amd64 to be installed instead.
|
|
40
40
|
# See: https://github.com/astral-sh/uv/issues/10945
|
|
@@ -46,4 +46,9 @@ setup(
|
|
|
46
46
|
"duckdb",
|
|
47
47
|
]
|
|
48
48
|
},
|
|
49
|
+
entry_points={
|
|
50
|
+
"dagster_dg.library": [
|
|
51
|
+
"dagster_sling = dagster_sling",
|
|
52
|
+
],
|
|
53
|
+
},
|
|
49
54
|
)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.26.7rc0"
|
|
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
|
{dagster-sling-0.26.7rc0 → dagster-sling-0.26.8}/dagster_sling.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|