-
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
71679a8
commit fb0aa3e
Showing
2 changed files
with
57 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
56 changes: 56 additions & 0 deletions
56
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,56 @@ | ||
from typing import Any, Mapping, NamedTuple | ||
|
||
from dagster._annotations import experimental | ||
from dagster._core.definitions.asset_spec import AssetSpec | ||
from dagster._record import record | ||
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. | ||
This applies to both Airbyte OSS and Cloud. | ||
""" | ||
|
||
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() |