Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⏱️ [Do not merge]: Release experimental interop methods to stable #192

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions airbyte/cloud/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def get_sync_result(

# Deletions

def _permanently_delete(
def permanently_delete(
self,
*,
delete_source: bool = False,
Expand All @@ -199,16 +199,16 @@ def _permanently_delete(
delete_source: Whether to also delete the source.
delete_destination: Whether to also delete the destination.
"""
self.workspace._permanently_delete_connection( # noqa: SLF001 # Non-public API (for now)
self.workspace.permanently_delete_connection( # Non-public API (for now)
connection=self
)

if delete_source:
self.workspace._permanently_delete_source( # noqa: SLF001 # Non-public API (for now)
self.workspace.permanently_delete_source( # Non-public API (for now)
source=self.source_id
)

if delete_destination:
self.workspace._permanently_delete_destination( # noqa: SLF001 # Non-public API
self.workspace.permanently_delete_destination( # Non-public API
destination=self.destination_id,
)
aaronsteers marked this conversation as resolved.
Show resolved Hide resolved
21 changes: 3 additions & 18 deletions airbyte/cloud/experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,6 @@
stacklevel=2,
)


class CloudWorkspace(Stable_CloudWorkspace):
__doc__ = (
f"Experimental implementation of `.CloudWorkspace`.\n\n{Stable_CloudConnection.__doc__}"
)
deploy_connection = Stable_CloudWorkspace._deploy_connection
deploy_source = Stable_CloudWorkspace._deploy_source
deploy_cache_as_destination = Stable_CloudWorkspace._deploy_cache_as_destination
permanently_delete_connection = Stable_CloudWorkspace._permanently_delete_connection
permanently_delete_source = Stable_CloudWorkspace._permanently_delete_source
permanently_delete_destination = Stable_CloudWorkspace._permanently_delete_destination


class CloudConnection(Stable_CloudConnection):
__doc__ = (
f"Experimental implementation of `.CloudConnection`.\n\n{Stable_CloudConnection.__doc__}"
)
permanently_delete = Stable_CloudConnection._permanently_delete
# All experimental methods are now stable.
CloudConnection = Stable_CloudConnection
CloudWorkspace = Stable_CloudWorkspace
10 changes: 5 additions & 5 deletions airbyte/cloud/workspaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def _deploy_source(

return deployed_source.source_id

def _permanently_delete_source(
def permanently_delete_source(
self,
source: str | Source,
) -> None:
Expand Down Expand Up @@ -147,7 +147,7 @@ def _deploy_cache_as_destination(

return deployed_destination.destination_id

def _permanently_delete_destination(
def permanently_delete_destination(
self,
*,
destination: str | None = None,
Expand Down Expand Up @@ -277,7 +277,7 @@ def get_connection(
connection_id=connection_id,
)

def _permanently_delete_connection(
def permanently_delete_connection(
self,
connection: str | CloudConnection,
*,
Expand All @@ -301,10 +301,10 @@ def _permanently_delete_connection(
workspace_id=self.workspace_id,
)
if delete_source:
self._permanently_delete_source(source=connection.source_id)
self.permanently_delete_source(source=connection.source_id)

if delete_destination:
self._permanently_delete_destination(destination=connection.destination_id)
self.permanently_delete_destination(destination=connection.destination_id)

# Run syncs

Expand Down
6 changes: 3 additions & 3 deletions tests/integration_tests/cloud/test_cloud_sql_reads.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ def test_deploy_and_run_and_read(

# Cleanup
with suppress(Exception):
cloud_workspace._permanently_delete_connection(
cloud_workspace.permanently_delete_connection(
connection_id=connection_id,
delete_source=True,
delete_destination=True,
)
with suppress(Exception):
cloud_workspace._permanently_delete_source(source_id=source_id)
cloud_workspace.permanently_delete_source(source_id=source_id)
with suppress(Exception):
cloud_workspace._permanently_delete_destination(destination_id=destination_id)
cloud_workspace.permanently_delete_destination(destination_id=destination_id)


@pytest.mark.parametrize(
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/cloud/test_cloud_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ def test_deploy_and_run_connection(
assert cache.stream_names
assert cache.streams["users"].to_pandas()

cloud_workspace._permanently_delete_connection(connection_id=connection_id)
cloud_workspace.permanently_delete_connection(connection_id=connection_id)
6 changes: 3 additions & 3 deletions tests/integration_tests/cloud/test_cloud_workspaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_deploy_source(
source.check()
source_id: str = cloud_workspace._deploy_source(source)

cloud_workspace._permanently_delete_source(source=source_id)
cloud_workspace.permanently_delete_source(source=source_id)


def test_deploy_cache_as_destination(
Expand All @@ -38,7 +38,7 @@ def test_deploy_cache_as_destination(
schema_name="public",
)
destination_id: str = cloud_workspace._deploy_cache_as_destination(cache=cache)
cloud_workspace._permanently_delete_destination(destination=destination_id)
cloud_workspace.permanently_delete_destination(destination=destination_id)


def test_deploy_connection(
Expand Down Expand Up @@ -69,7 +69,7 @@ def test_deploy_connection(
assert set(connection.stream_names) == set(["users", "products", "purchases"])
assert connection.table_prefix == "abc_deleteme_"
# assert connection.table_suffix == "" # Suffix not supported in CloudConnection
cloud_workspace._permanently_delete_connection(
cloud_workspace.permanently_delete_connection(
connection=connection,
delete_source=True,
delete_destination=True,
Expand Down