-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dagster-airbyte] Scaffold DagsterAirbyteTranslator for rework
- Loading branch information
1 parent
93a7844
commit 3dcc50c
Showing
2 changed files
with
58 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
python_modules/libraries/dagster-airbyte/dagster_airbyte/translator.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
from typing import Any, Mapping, NamedTuple | ||
|
||
from dagster._record import record | ||
from dagster._annotations import experimental | ||
from dagster._core.definitions.asset_spec import AssetSpec | ||
from dagster._serdes.serdes import whitelist_for_serdes | ||
|
||
|
||
class AirbyteConnectionTableProps(NamedTuple): | ||
... | ||
|
||
|
||
@whitelist_for_serdes | ||
@record | ||
class AirbyteConnection: | ||
"""Represents an Airbyte connection, based on data as returned from the API.""" | ||
|
||
@classmethod | ||
def from_connection_details( | ||
cls, | ||
connection_details: Mapping[str, Any], | ||
) -> "AirbyteConnection": | ||
raise NotImplementedError() | ||
|
||
|
||
@whitelist_for_serdes | ||
@record | ||
class AirbyteDestination: | ||
"""Represents an Airbyte destination, based on data as returned from the API.""" | ||
|
||
@classmethod | ||
def from_destination_details( | ||
cls, | ||
destination_details: Mapping[str, Any], | ||
) -> "AirbyteDestination": | ||
raise NotImplementedError() | ||
|
||
|
||
@record | ||
class AirbyteWorkspaceData: | ||
"""A record representing all content in an Airbyte workspace. | ||
Provided as context for the translator so that it can resolve dependencies between content. | ||
""" | ||
|
||
connections_by_id: Mapping[str, AirbyteConnection] | ||
destinations_by_id: Mapping[str, AirbyteDestination] | ||
|
||
|
||
@experimental | ||
class DagsterAirbyteTranslator: | ||
"""Translator class which converts a `AirbyteConnectionTableProps` object into AssetSpecs. | ||
Subclass this class to implement custom logic for Airbyte content. | ||
""" | ||
|
||
def get_asset_spec(self, props: AirbyteConnectionTableProps) -> AssetSpec: | ||
"""Get the AssetSpec for a table synced by an Airbyte connection.""" | ||
raise NotImplementedError() |