dagster-sling 0.27.13__py3-none-any.whl → 0.27.14__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.
Potentially problematic release.
This version of dagster-sling might be problematic. Click here for more details.
- dagster_sling/components/sling_replication_collection/component.py +53 -49
- dagster_sling/resources.py +6 -2
- dagster_sling/version.py +1 -1
- {dagster_sling-0.27.13.dist-info → dagster_sling-0.27.14.dist-info}/METADATA +2 -2
- {dagster_sling-0.27.13.dist-info → dagster_sling-0.27.14.dist-info}/RECORD +9 -9
- {dagster_sling-0.27.13.dist-info → dagster_sling-0.27.14.dist-info}/WHEEL +0 -0
- {dagster_sling-0.27.13.dist-info → dagster_sling-0.27.14.dist-info}/entry_points.txt +0 -0
- {dagster_sling-0.27.13.dist-info → dagster_sling-0.27.14.dist-info}/licenses/LICENSE +0 -0
- {dagster_sling-0.27.13.dist-info → dagster_sling-0.27.14.dist-info}/top_level.txt +0 -0
|
@@ -20,7 +20,12 @@ from dagster.components.core.context import ComponentLoadContext
|
|
|
20
20
|
from dagster.components.resolved.context import ResolutionContext
|
|
21
21
|
from dagster.components.resolved.core_models import OpSpec
|
|
22
22
|
from dagster.components.scaffold.scaffold import scaffold_with
|
|
23
|
-
from dagster.components.utils.translation import
|
|
23
|
+
from dagster.components.utils.translation import (
|
|
24
|
+
ComponentTranslator,
|
|
25
|
+
TranslationFn,
|
|
26
|
+
TranslationFnResolver,
|
|
27
|
+
create_component_translator_cls,
|
|
28
|
+
)
|
|
24
29
|
from dagster_shared.utils.warnings import deprecation_warning
|
|
25
30
|
from pydantic import BaseModel, ConfigDict, Field
|
|
26
31
|
from typing_extensions import TypeAlias
|
|
@@ -35,15 +40,6 @@ from dagster_sling.resources import AssetExecutionContext, SlingConnectionResour
|
|
|
35
40
|
SlingMetadataAddons: TypeAlias = Literal["column_metadata", "row_count"]
|
|
36
41
|
|
|
37
42
|
|
|
38
|
-
class ProxyDagsterSlingTranslator(DagsterSlingTranslator):
|
|
39
|
-
def __init__(self, fn: TranslationFn[Mapping[str, Any]]):
|
|
40
|
-
self._fn = fn
|
|
41
|
-
|
|
42
|
-
def get_asset_spec(self, stream_definition: Mapping[str, Any]) -> AssetSpec:
|
|
43
|
-
base_asset_spec = super().get_asset_spec(stream_definition)
|
|
44
|
-
return self._fn(base_asset_spec, stream_definition)
|
|
45
|
-
|
|
46
|
-
|
|
47
43
|
@dataclass
|
|
48
44
|
class SlingReplicationSpecModel(Resolvable):
|
|
49
45
|
path: str
|
|
@@ -67,32 +63,6 @@ class SlingReplicationSpecModel(Resolvable):
|
|
|
67
63
|
),
|
|
68
64
|
] = field(default_factory=list)
|
|
69
65
|
|
|
70
|
-
@cached_property
|
|
71
|
-
def translator(self):
|
|
72
|
-
if self.translation:
|
|
73
|
-
return ProxyDagsterSlingTranslator(self.translation)
|
|
74
|
-
return DagsterSlingTranslator()
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
def resolve_resource(
|
|
78
|
-
context: ResolutionContext,
|
|
79
|
-
sling,
|
|
80
|
-
) -> Optional[SlingResource]:
|
|
81
|
-
if sling:
|
|
82
|
-
deprecation_warning(
|
|
83
|
-
"The `sling` field is deprecated, use `connections` instead. This field will be removed in a future release.",
|
|
84
|
-
"1.11.1",
|
|
85
|
-
)
|
|
86
|
-
return SlingResource(**context.resolve_value(sling.model_dump())) if sling else None
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
def replicate(
|
|
90
|
-
context: AssetExecutionContext,
|
|
91
|
-
connections: list[SlingConnectionResource],
|
|
92
|
-
) -> Iterator[Union[AssetMaterialization, MaterializeResult]]:
|
|
93
|
-
sling = SlingResource(connections=connections)
|
|
94
|
-
yield from sling.replicate(context=context)
|
|
95
|
-
|
|
96
66
|
|
|
97
67
|
class SlingConnectionResourcePropertiesModel(Resolvable, BaseModel):
|
|
98
68
|
"""Properties of a Sling connection resource."""
|
|
@@ -132,6 +102,18 @@ ResolvedSlingConnections: TypeAlias = Annotated[
|
|
|
132
102
|
]
|
|
133
103
|
|
|
134
104
|
|
|
105
|
+
def resolve_resource(
|
|
106
|
+
context: ResolutionContext,
|
|
107
|
+
sling,
|
|
108
|
+
) -> Optional[SlingResource]:
|
|
109
|
+
if sling:
|
|
110
|
+
deprecation_warning(
|
|
111
|
+
"The `sling` field is deprecated, use `connections` instead. This field will be removed in a future release.",
|
|
112
|
+
"1.11.1",
|
|
113
|
+
)
|
|
114
|
+
return SlingResource(**context.resolve_value(sling.model_dump())) if sling else None
|
|
115
|
+
|
|
116
|
+
|
|
135
117
|
@public
|
|
136
118
|
@scaffold_with(SlingReplicationComponentScaffolder)
|
|
137
119
|
@dataclass
|
|
@@ -157,28 +139,24 @@ class SlingReplicationCollectionComponent(Component, Resolvable):
|
|
|
157
139
|
def sling_resource(self) -> SlingResource:
|
|
158
140
|
return self.resource or SlingResource(connections=self.connections)
|
|
159
141
|
|
|
142
|
+
@cached_property
|
|
143
|
+
def _base_translator(self) -> DagsterSlingTranslator:
|
|
144
|
+
return DagsterSlingTranslator()
|
|
145
|
+
|
|
146
|
+
def get_asset_spec(self, stream_definition: Mapping[str, Any]) -> AssetSpec:
|
|
147
|
+
return self._base_translator.get_asset_spec(stream_definition)
|
|
148
|
+
|
|
160
149
|
def build_asset(
|
|
161
150
|
self, context: ComponentLoadContext, replication_spec_model: SlingReplicationSpecModel
|
|
162
151
|
) -> AssetsDefinition:
|
|
163
152
|
op_spec = replication_spec_model.op or OpSpec()
|
|
164
|
-
|
|
165
|
-
class ReplicationTranslatorWithCodeReferences(DagsterSlingTranslator):
|
|
166
|
-
def get_asset_spec(self, stream_definition: Mapping[str, Any]) -> AssetSpec:
|
|
167
|
-
asset_spec = replication_spec_model.translator.get_asset_spec(stream_definition)
|
|
168
|
-
return merge_code_references(
|
|
169
|
-
asset_spec,
|
|
170
|
-
[
|
|
171
|
-
LocalFileCodeReference(
|
|
172
|
-
file_path=str(context.path / replication_spec_model.path)
|
|
173
|
-
)
|
|
174
|
-
],
|
|
175
|
-
)
|
|
153
|
+
translator = SlingComponentTranslator(self, replication_spec_model, context.path)
|
|
176
154
|
|
|
177
155
|
@sling_assets(
|
|
178
156
|
name=op_spec.name or Path(replication_spec_model.path).stem,
|
|
179
157
|
op_tags=op_spec.tags,
|
|
180
158
|
replication_config=context.path / replication_spec_model.path,
|
|
181
|
-
dagster_sling_translator=
|
|
159
|
+
dagster_sling_translator=translator,
|
|
182
160
|
backfill_policy=op_spec.backfill_policy,
|
|
183
161
|
)
|
|
184
162
|
def _asset(context: AssetExecutionContext):
|
|
@@ -207,3 +185,29 @@ class SlingReplicationCollectionComponent(Component, Resolvable):
|
|
|
207
185
|
return Definitions(
|
|
208
186
|
assets=[self.build_asset(context, replication) for replication in self.replications],
|
|
209
187
|
)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
class SlingComponentTranslator(
|
|
191
|
+
create_component_translator_cls(SlingReplicationCollectionComponent, DagsterSlingTranslator),
|
|
192
|
+
ComponentTranslator[SlingReplicationCollectionComponent],
|
|
193
|
+
):
|
|
194
|
+
def __init__(
|
|
195
|
+
self,
|
|
196
|
+
component: SlingReplicationCollectionComponent,
|
|
197
|
+
replication_spec: SlingReplicationSpecModel,
|
|
198
|
+
base_path: Path,
|
|
199
|
+
):
|
|
200
|
+
self._component = component
|
|
201
|
+
self._replication_spec = replication_spec
|
|
202
|
+
self._base_path = base_path
|
|
203
|
+
|
|
204
|
+
def get_asset_spec(self, stream_definition: Mapping[str, Any]) -> AssetSpec:
|
|
205
|
+
spec = super().get_asset_spec(stream_definition)
|
|
206
|
+
if self._replication_spec.translation is not None:
|
|
207
|
+
spec = self._replication_spec.translation(spec, stream_definition)
|
|
208
|
+
|
|
209
|
+
# always add code references to the replication spec
|
|
210
|
+
code_reference = LocalFileCodeReference(
|
|
211
|
+
file_path=str(self._base_path / self._replication_spec.path)
|
|
212
|
+
)
|
|
213
|
+
return merge_code_references(spec, [code_reference])
|
dagster_sling/resources.py
CHANGED
|
@@ -279,8 +279,12 @@ class SlingResource(ConfigurableResource):
|
|
|
279
279
|
yield
|
|
280
280
|
|
|
281
281
|
def _clean_line(self, line: str) -> str:
|
|
282
|
-
"""Removes ANSI escape sequences from a line of output."""
|
|
283
|
-
|
|
282
|
+
"""Removes ANSI escape sequences and Sling log prefixes from a line of output."""
|
|
283
|
+
line = ANSI_ESCAPE.sub("", line)
|
|
284
|
+
# Remove Sling log format prefix: "{timestamp} {LEVEL} " (e.g., "1:04PM INF ")
|
|
285
|
+
# Match pattern: optional timestamp followed by log level (INF, WRN, ERR, DBG) and space
|
|
286
|
+
line = re.sub(r"^\d{1,2}:\d{2}[AP]M\s+(INF|WRN|ERR|DBG)\s+", "", line)
|
|
287
|
+
return line
|
|
284
288
|
|
|
285
289
|
def _clean_timestamp_log(self, line: str):
|
|
286
290
|
"""Remove timestamp from log gather from sling cli to reduce redundency in dagster log.
|
dagster_sling/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.27.
|
|
1
|
+
__version__ = "0.27.14"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dagster-sling
|
|
3
|
-
Version: 0.27.
|
|
3
|
+
Version: 0.27.14
|
|
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
|
|
@@ -15,7 +15,7 @@ Classifier: License :: OSI Approved :: Apache Software License
|
|
|
15
15
|
Classifier: Operating System :: OS Independent
|
|
16
16
|
Requires-Python: >=3.9,<3.14
|
|
17
17
|
License-File: LICENSE
|
|
18
|
-
Requires-Dist: dagster==1.11.
|
|
18
|
+
Requires-Dist: dagster==1.11.14
|
|
19
19
|
Requires-Dist: sling>=1.1.5
|
|
20
20
|
Requires-Dist: sling-mac-arm64; platform_system == "Darwin" and platform_machine == "arm64"
|
|
21
21
|
Provides-Extra: test
|
|
@@ -3,17 +3,17 @@ dagster_sling/asset_decorator.py,sha256=wWHHMkWq5ZsLQ9eEWxw6rpkLUm3v_Vg2lHv91cU7
|
|
|
3
3
|
dagster_sling/asset_defs.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
dagster_sling/dagster_sling_translator.py,sha256=4HRgqTp5PMxO-73jEvB1oMbguYGfhSlNYVogCtHMWGA,23995
|
|
5
5
|
dagster_sling/py.typed,sha256=la67KBlbjXN-_-DfGNcdOcjYumVpKG_Tkw-8n5dnGB4,8
|
|
6
|
-
dagster_sling/resources.py,sha256=
|
|
6
|
+
dagster_sling/resources.py,sha256=N6Sy_9ykqJYB4NIY_4QAuYyndF_A_8UdKGy-zIbkHM8,26262
|
|
7
7
|
dagster_sling/sling_event_iterator.py,sha256=zLlcYAO-ZbTw-K0lbaIMDuzQPmhNSRrIMcNRvvWkkNY,8460
|
|
8
8
|
dagster_sling/sling_replication.py,sha256=24Fwuokmc2l_8HBStoTMvZSj77Qpt8ZcKUSAJNq34_M,1113
|
|
9
|
-
dagster_sling/version.py,sha256=
|
|
9
|
+
dagster_sling/version.py,sha256=L7VpQaY2T34JkbqawqNFJ6nG-6vihOrlyqaDfc_Z1ww,24
|
|
10
10
|
dagster_sling/components/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
11
|
dagster_sling/components/sling_replication_collection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
-
dagster_sling/components/sling_replication_collection/component.py,sha256=
|
|
12
|
+
dagster_sling/components/sling_replication_collection/component.py,sha256=guSZkRg0KkPdbqJK8lD7RkAYwYOkiI4mqBQ4skmGa1M,8124
|
|
13
13
|
dagster_sling/components/sling_replication_collection/scaffolder.py,sha256=b0L4DtJifCg4FGEQ9E3O9N93WyiGSBlJikSbJOLsq1c,608
|
|
14
|
-
dagster_sling-0.27.
|
|
15
|
-
dagster_sling-0.27.
|
|
16
|
-
dagster_sling-0.27.
|
|
17
|
-
dagster_sling-0.27.
|
|
18
|
-
dagster_sling-0.27.
|
|
19
|
-
dagster_sling-0.27.
|
|
14
|
+
dagster_sling-0.27.14.dist-info/licenses/LICENSE,sha256=4lsMW-RCvfVD4_F57wrmpe3vX1xwUk_OAKKmV_XT7Z0,11348
|
|
15
|
+
dagster_sling-0.27.14.dist-info/METADATA,sha256=D6Pnhyjq5YQ3HkJuQNULxouQKKFOXPUDivZ9A2yMW8A,1184
|
|
16
|
+
dagster_sling-0.27.14.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
17
|
+
dagster_sling-0.27.14.dist-info/entry_points.txt,sha256=X75y2oDwNMmfILdNMk3CNOsskBN-RQnDoFV9D3PgVvc,64
|
|
18
|
+
dagster_sling-0.27.14.dist-info/top_level.txt,sha256=eoJKEGsD6fqIEmF6xaF8tj5Kq9a7riWyRHbZn6oHTk8,14
|
|
19
|
+
dagster_sling-0.27.14.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|