dagster-airbyte 0.27.15__py3-none-any.whl → 0.28.0__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-airbyte might be problematic. Click here for more details.
- dagster_airbyte/asset_defs.py +14 -6
- dagster_airbyte/components/workspace_component/component.py +81 -0
- dagster_airbyte/version.py +1 -1
- {dagster_airbyte-0.27.15.dist-info → dagster_airbyte-0.28.0.dist-info}/METADATA +3 -3
- {dagster_airbyte-0.27.15.dist-info → dagster_airbyte-0.28.0.dist-info}/RECORD +9 -9
- {dagster_airbyte-0.27.15.dist-info → dagster_airbyte-0.28.0.dist-info}/WHEEL +0 -0
- {dagster_airbyte-0.27.15.dist-info → dagster_airbyte-0.28.0.dist-info}/entry_points.txt +0 -0
- {dagster_airbyte-0.27.15.dist-info → dagster_airbyte-0.28.0.dist-info}/licenses/LICENSE +0 -0
- {dagster_airbyte-0.27.15.dist-info → dagster_airbyte-0.28.0.dist-info}/top_level.txt +0 -0
dagster_airbyte/asset_defs.py
CHANGED
|
@@ -20,7 +20,7 @@ from dagster import (
|
|
|
20
20
|
SourceAsset,
|
|
21
21
|
_check as check,
|
|
22
22
|
)
|
|
23
|
-
from dagster._annotations import beta,
|
|
23
|
+
from dagster._annotations import beta, hidden_param, only_allow_hidden_params_in_kwargs
|
|
24
24
|
from dagster._core.definitions import AssetsDefinition, multi_asset
|
|
25
25
|
from dagster._core.definitions.assets.definition.cacheable_assets_definition import (
|
|
26
26
|
AssetsDefinitionCacheableData,
|
|
@@ -253,7 +253,14 @@ def _build_airbyte_assets_from_metadata(
|
|
|
253
253
|
return _assets
|
|
254
254
|
|
|
255
255
|
|
|
256
|
-
@
|
|
256
|
+
@hidden_param(
|
|
257
|
+
param="legacy_freshness_policy",
|
|
258
|
+
breaking_version="1.13.0",
|
|
259
|
+
)
|
|
260
|
+
@hidden_param(
|
|
261
|
+
param="auto_materialize_policy",
|
|
262
|
+
breaking_version="1.10.0",
|
|
263
|
+
)
|
|
257
264
|
def build_airbyte_assets(
|
|
258
265
|
connection_id: str,
|
|
259
266
|
destination_tables: Sequence[str],
|
|
@@ -265,9 +272,8 @@ def build_airbyte_assets(
|
|
|
265
272
|
deps: Optional[Iterable[Union[CoercibleToAssetKey, AssetsDefinition, SourceAsset]]] = None,
|
|
266
273
|
upstream_assets: Optional[set[AssetKey]] = None,
|
|
267
274
|
schema_by_table_name: Optional[Mapping[str, TableSchema]] = None,
|
|
268
|
-
legacy_freshness_policy: Optional[LegacyFreshnessPolicy] = None,
|
|
269
275
|
stream_to_asset_map: Optional[Mapping[str, str]] = None,
|
|
270
|
-
|
|
276
|
+
**kwargs,
|
|
271
277
|
) -> Sequence[AssetsDefinition]:
|
|
272
278
|
"""Builds a set of assets representing the tables created by an Airbyte sync operation.
|
|
273
279
|
|
|
@@ -287,11 +293,13 @@ def build_airbyte_assets(
|
|
|
287
293
|
deps (Optional[Sequence[Union[AssetsDefinition, SourceAsset, str, AssetKey]]]):
|
|
288
294
|
A list of assets to add as sources.
|
|
289
295
|
upstream_assets (Optional[Set[AssetKey]]): Deprecated, use deps instead. A list of assets to add as sources.
|
|
290
|
-
legacy_freshness_policy (Optional[LegacyFreshnessPolicy]): A legacy freshness policy to apply to the assets
|
|
291
296
|
stream_to_asset_map (Optional[Mapping[str, str]]): A mapping of an Airbyte stream name to a Dagster asset.
|
|
292
297
|
This allows the use of the "prefix" setting in Airbyte with special characters that aren't valid asset names.
|
|
293
|
-
auto_materialize_policy (Optional[AutoMaterializePolicy]): An auto materialization policy to apply to the assets.
|
|
294
298
|
"""
|
|
299
|
+
only_allow_hidden_params_in_kwargs(build_airbyte_assets, kwargs)
|
|
300
|
+
legacy_freshness_policy = kwargs.get("legacy_freshness_policy")
|
|
301
|
+
auto_materialize_policy = kwargs.get("auto_materialize_policy")
|
|
302
|
+
|
|
295
303
|
if upstream_assets is not None and deps is not None:
|
|
296
304
|
raise DagsterInvalidDefinitionError(
|
|
297
305
|
"Cannot specify both deps and upstream_assets to build_airbyte_assets. Use only deps"
|
|
@@ -7,6 +7,7 @@ from typing import Annotated, Callable, Optional, Union
|
|
|
7
7
|
import dagster as dg
|
|
8
8
|
import pydantic
|
|
9
9
|
from dagster._annotations import superseded
|
|
10
|
+
from dagster._symbol_annotations.public import public
|
|
10
11
|
from dagster._utils.names import clean_name
|
|
11
12
|
from dagster.components.component.state_backed_component import StateBackedComponent
|
|
12
13
|
from dagster.components.resolved.base import resolve_fields
|
|
@@ -172,11 +173,31 @@ def resolve_airbyte_workspace_type(context: dg.ResolutionContext, model):
|
|
|
172
173
|
check.failed(f"Unknown Airbyte workspace type: {type(model)}")
|
|
173
174
|
|
|
174
175
|
|
|
176
|
+
@public
|
|
175
177
|
@dg.scaffold_with(AirbyteWorkspaceComponentScaffolder)
|
|
176
178
|
class AirbyteWorkspaceComponent(StateBackedComponent, dg.Model, dg.Resolvable):
|
|
177
179
|
"""Loads Airbyte connections from a given Airbyte workspace as Dagster assets.
|
|
178
180
|
Materializing these assets will trigger a sync of the Airbyte connection, enabling
|
|
179
181
|
you to schedule Airbyte syncs using Dagster.
|
|
182
|
+
|
|
183
|
+
Example:
|
|
184
|
+
|
|
185
|
+
.. code-block:: yaml
|
|
186
|
+
|
|
187
|
+
# defs.yaml
|
|
188
|
+
|
|
189
|
+
type: dagster_airbyte.AirbyteWorkspaceComponent
|
|
190
|
+
attributes:
|
|
191
|
+
workspace:
|
|
192
|
+
rest_api_base_url: http://localhost:8000/api/public/v1
|
|
193
|
+
configuration_api_base_url: http://localhost:8000/api/v1
|
|
194
|
+
workspace_id: your-workspace-id
|
|
195
|
+
client_id: "{{ env.AIRBYTE_CLIENT_ID }}"
|
|
196
|
+
client_secret: "{{ env.AIRBYTE_CLIENT_SECRET }}"
|
|
197
|
+
connection_selector:
|
|
198
|
+
by_name:
|
|
199
|
+
- my_postgres_to_snowflake_connection
|
|
200
|
+
- my_mysql_to_bigquery_connection
|
|
180
201
|
"""
|
|
181
202
|
|
|
182
203
|
workspace: Annotated[
|
|
@@ -220,12 +241,72 @@ class AirbyteWorkspaceComponent(StateBackedComponent, dg.Model, dg.Resolvable):
|
|
|
220
241
|
def _base_translator(self) -> DagsterAirbyteTranslator:
|
|
221
242
|
return DagsterAirbyteTranslator()
|
|
222
243
|
|
|
244
|
+
@public
|
|
223
245
|
def get_asset_spec(self, props: AirbyteConnectionTableProps) -> dg.AssetSpec:
|
|
246
|
+
"""Generates an AssetSpec for a given Airbyte connection table.
|
|
247
|
+
|
|
248
|
+
This method can be overridden in a subclass to customize how Airbyte connection tables
|
|
249
|
+
are converted to Dagster asset specs. By default, it delegates to the configured
|
|
250
|
+
DagsterAirbyteTranslator.
|
|
251
|
+
|
|
252
|
+
Args:
|
|
253
|
+
props: The AirbyteConnectionTableProps containing information about the connection
|
|
254
|
+
and table/stream being synced
|
|
255
|
+
|
|
256
|
+
Returns:
|
|
257
|
+
An AssetSpec that represents the Airbyte connection table as a Dagster asset
|
|
258
|
+
|
|
259
|
+
Example:
|
|
260
|
+
Override this method to add custom metadata to all Airbyte assets:
|
|
261
|
+
|
|
262
|
+
.. code-block:: python
|
|
263
|
+
|
|
264
|
+
from dagster_airbyte import AirbyteWorkspaceComponent
|
|
265
|
+
import dagster as dg
|
|
266
|
+
|
|
267
|
+
class CustomAirbyteWorkspaceComponent(AirbyteWorkspaceComponent):
|
|
268
|
+
def get_asset_spec(self, props):
|
|
269
|
+
base_spec = super().get_asset_spec(props)
|
|
270
|
+
return base_spec.replace_attributes(
|
|
271
|
+
metadata={
|
|
272
|
+
**base_spec.metadata,
|
|
273
|
+
"data_source": "airbyte",
|
|
274
|
+
"connection_id": props.connection_id
|
|
275
|
+
}
|
|
276
|
+
)
|
|
277
|
+
"""
|
|
224
278
|
return self._base_translator.get_asset_spec(props)
|
|
225
279
|
|
|
280
|
+
@public
|
|
226
281
|
def execute(
|
|
227
282
|
self, context: dg.AssetExecutionContext, airbyte: BaseAirbyteWorkspace
|
|
228
283
|
) -> Iterable[Union[dg.AssetMaterialization, dg.MaterializeResult]]:
|
|
284
|
+
"""Executes an Airbyte sync for the selected connection.
|
|
285
|
+
|
|
286
|
+
This method can be overridden in a subclass to customize the sync execution behavior,
|
|
287
|
+
such as adding custom logging or handling sync results differently.
|
|
288
|
+
|
|
289
|
+
Args:
|
|
290
|
+
context: The asset execution context provided by Dagster
|
|
291
|
+
airbyte: The BaseAirbyteWorkspace resource used to trigger and monitor syncs
|
|
292
|
+
|
|
293
|
+
Yields:
|
|
294
|
+
AssetMaterialization or MaterializeResult events from the Airbyte sync
|
|
295
|
+
|
|
296
|
+
Example:
|
|
297
|
+
Override this method to add custom logging during sync execution:
|
|
298
|
+
|
|
299
|
+
.. code-block:: python
|
|
300
|
+
|
|
301
|
+
from dagster_airbyte import AirbyteWorkspaceComponent
|
|
302
|
+
import dagster as dg
|
|
303
|
+
|
|
304
|
+
class CustomAirbyteWorkspaceComponent(AirbyteWorkspaceComponent):
|
|
305
|
+
def execute(self, context, airbyte):
|
|
306
|
+
context.log.info(f"Starting Airbyte sync for connection")
|
|
307
|
+
yield from super().execute(context, airbyte)
|
|
308
|
+
context.log.info("Airbyte sync completed successfully")
|
|
309
|
+
"""
|
|
229
310
|
yield from airbyte.sync_and_poll(context=context)
|
|
230
311
|
|
|
231
312
|
def _load_asset_specs(self, state: AirbyteWorkspaceData) -> Sequence[dg.AssetSpec]:
|
dagster_airbyte/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.
|
|
1
|
+
__version__ = "0.28.0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dagster-airbyte
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.28.0
|
|
4
4
|
Summary: Package for integrating Airbyte with Dagster.
|
|
5
5
|
Home-page: https://github.com/dagster-io/dagster/tree/master/python_modules/libraries/dagster-airbyte
|
|
6
6
|
Author: Dagster Labs
|
|
@@ -15,13 +15,13 @@ 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.
|
|
18
|
+
Requires-Dist: dagster==1.12.0
|
|
19
19
|
Requires-Dist: requests
|
|
20
20
|
Provides-Extra: test
|
|
21
21
|
Requires-Dist: requests-mock; extra == "test"
|
|
22
22
|
Requires-Dist: flaky; extra == "test"
|
|
23
23
|
Provides-Extra: managed
|
|
24
|
-
Requires-Dist: dagster-managed-elements==0.
|
|
24
|
+
Requires-Dist: dagster-managed-elements==0.28.0; extra == "managed"
|
|
25
25
|
Dynamic: author
|
|
26
26
|
Dynamic: author-email
|
|
27
27
|
Dynamic: classifier
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
dagster_airbyte/__init__.py,sha256=Bc3BuYTIcz5XU6NbKHqIemxgFSydLsqVLyLcx6K2pVA,2024
|
|
2
2
|
dagster_airbyte/asset_decorator.py,sha256=ziG1U5qleIIR8xbYmoKSA00gLazbrd09FzcgmGdZmkY,4640
|
|
3
|
-
dagster_airbyte/asset_defs.py,sha256=
|
|
3
|
+
dagster_airbyte/asset_defs.py,sha256=uHMW_m54kqoEc0w4CvpDQqL5bmJfmmyzv_KXEeM9x_g,51662
|
|
4
4
|
dagster_airbyte/cli.py,sha256=HErteP1MjfHozKKSrznh0yAreKETbXp5NDHzXGsdvvE,425
|
|
5
5
|
dagster_airbyte/ops.py,sha256=oOEczVYpqVRTc1-0osfpR5FZbPjNJDYihgRjk_qtOQA,4229
|
|
6
6
|
dagster_airbyte/py.typed,sha256=la67KBlbjXN-_-DfGNcdOcjYumVpKG_Tkw-8n5dnGB4,8
|
|
@@ -8,10 +8,10 @@ dagster_airbyte/resources.py,sha256=AXN_mtNl_JKauoOY29wyuiv9jjAiCNF9M4baVCQPMYo,
|
|
|
8
8
|
dagster_airbyte/translator.py,sha256=RY2LhGPACIfyd2zOSH1swdLz4koX6_bvclW-alS3Bic,7547
|
|
9
9
|
dagster_airbyte/types.py,sha256=TYUjI3skjLYeANjesgJ-IAJNu8bAnL1ymsUfz5LsRTE,1565
|
|
10
10
|
dagster_airbyte/utils.py,sha256=wG9119kXi87JgcOjK7iNozr-svZocJBQYoHBMmnXZcE,4092
|
|
11
|
-
dagster_airbyte/version.py,sha256=
|
|
11
|
+
dagster_airbyte/version.py,sha256=MRQGtOXBhcDKeeNOL0LiB-cllo6kfd8_KGJOvaDp0XQ,23
|
|
12
12
|
dagster_airbyte/components/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
13
|
dagster_airbyte/components/workspace_component/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
-
dagster_airbyte/components/workspace_component/component.py,sha256=
|
|
14
|
+
dagster_airbyte/components/workspace_component/component.py,sha256=Ao7dXsDuEUXTpBENJy83cnQfF-fceZGBMKxoxFoC5DE,14463
|
|
15
15
|
dagster_airbyte/components/workspace_component/scaffolder.py,sha256=zk5HDJ6C8zcfUWKslJVyqyBB0LV3JzNAocY2ptT517s,1046
|
|
16
16
|
dagster_airbyte/managed/__init__.py,sha256=6SBtyNOMJ9Cu2UIwFExJHpL_ZVFo3rPMvyIxVOsKvWE,469
|
|
17
17
|
dagster_airbyte/managed/reconciliation.py,sha256=xoVfqPBpNSldkiqOLIPnc7ei8CppHKWtzv8bvxjdqlI,34859
|
|
@@ -19,9 +19,9 @@ dagster_airbyte/managed/types.py,sha256=isPfX8L9YwtZAf9Vk4hhxBePLR00AEldsdK2TsM1
|
|
|
19
19
|
dagster_airbyte/managed/generated/__init__.py,sha256=eYq-yfXEeffuKAVFXY8plD0se1wHjFNVqklpbu9gljw,108
|
|
20
20
|
dagster_airbyte/managed/generated/destinations.py,sha256=x1wmWlXvOJHtfaZva3ErdKuVS--sDvfidSXR5ji9G5w,119692
|
|
21
21
|
dagster_airbyte/managed/generated/sources.py,sha256=y0TPNvcRd8c9mhje-NoXsHeKRPt1nXcpww8mNAtqCps,282685
|
|
22
|
-
dagster_airbyte-0.
|
|
23
|
-
dagster_airbyte-0.
|
|
24
|
-
dagster_airbyte-0.
|
|
25
|
-
dagster_airbyte-0.
|
|
26
|
-
dagster_airbyte-0.
|
|
27
|
-
dagster_airbyte-0.
|
|
22
|
+
dagster_airbyte-0.28.0.dist-info/licenses/LICENSE,sha256=4lsMW-RCvfVD4_F57wrmpe3vX1xwUk_OAKKmV_XT7Z0,11348
|
|
23
|
+
dagster_airbyte-0.28.0.dist-info/METADATA,sha256=za8j6v-hzsbyohRvqCr94JdA4S8PCvY7Ojs_b9vm6W4,1166
|
|
24
|
+
dagster_airbyte-0.28.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
25
|
+
dagster_airbyte-0.28.0.dist-info/entry_points.txt,sha256=096yvfMP-gNsCgDg9vDQtinis5QGpD-e_kHEhcHaML8,120
|
|
26
|
+
dagster_airbyte-0.28.0.dist-info/top_level.txt,sha256=HLwIRQCzqItn88_KbPP8DNTKKQEBUVKk6NCn4PrCtqY,16
|
|
27
|
+
dagster_airbyte-0.28.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|