Skip to content

Commit

Permalink
Feat: Add Cloud deploy functionality out of experimental status (#419)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronsteers authored Dec 10, 2024
1 parent ea54711 commit 5e472fc
Show file tree
Hide file tree
Showing 67 changed files with 2,101 additions and 1,425 deletions.
2 changes: 1 addition & 1 deletion airbyte/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@

# Submodules imported here for documentation reasons: https://github.com/mitmproxy/pdoc/issues/757
if TYPE_CHECKING:
# ruff: noqa: TCH004 # imports used for more than type checking
# ruff: noqa: TC004 # imports used for more than type checking
from airbyte import (
caches,
callbacks,
Expand Down
7 changes: 5 additions & 2 deletions airbyte/_executors/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@

from airbyte import exceptions as exc
from airbyte._message_iterators import AirbyteMessageIterator
from airbyte.sources.registry import ConnectorMetadata


if TYPE_CHECKING:
from collections.abc import Generator, Iterable, Iterator

from airbyte.sources.registry import ConnectorMetadata


_LATEST_VERSION = "latest"

Expand Down Expand Up @@ -161,7 +162,9 @@ def __init__(
if not name and not metadata:
raise exc.PyAirbyteInternalError(message="Either name or metadata must be provided.")

self.name: str = name or cast(ConnectorMetadata, metadata).name # metadata is not None here
self.name: str = (
name or cast("ConnectorMetadata", metadata).name
) # metadata is not None here
self.metadata: ConnectorMetadata | None = metadata
self.enforce_version: bool = target_version is not None

Expand Down
2 changes: 1 addition & 1 deletion airbyte/_executors/declarative.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __init__(
self.name = name
self._manifest_dict: dict
if isinstance(manifest, Path):
self._manifest_dict = cast(dict, yaml.safe_load(manifest.read_text()))
self._manifest_dict = cast("dict", yaml.safe_load(manifest.read_text()))

elif isinstance(manifest, dict):
self._manifest_dict = manifest
Expand Down
2 changes: 1 addition & 1 deletion airbyte/_executors/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _try_get_source_manifest(
)
response.raise_for_status() # Raise HTTPError exception if the download failed
try:
return cast(dict, yaml.safe_load(response.text))
return cast("dict", yaml.safe_load(response.text))
except yaml.YAMLError as ex:
raise exc.AirbyteConnectorInstallationError(
message="Failed to parse the connector manifest YAML.",
Expand Down
10 changes: 5 additions & 5 deletions airbyte/_message_iterators.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from __future__ import annotations

import datetime
import sys
from collections.abc import Iterator
from typing import IO, TYPE_CHECKING, cast
Expand All @@ -27,6 +26,7 @@


if TYPE_CHECKING:
import datetime
from collections.abc import Callable, Generator, Iterable, Iterator
from pathlib import Path

Expand Down Expand Up @@ -98,7 +98,7 @@ def generator() -> Generator[AirbyteMessage, None, None]:
data=record,
emitted_at=int(
cast(
datetime.datetime, record.get(AB_EXTRACTED_AT_COLUMN)
"datetime.datetime", record.get(AB_EXTRACTED_AT_COLUMN)
).timestamp()
),
# `meta` and `namespace` are not handled:
Expand Down Expand Up @@ -134,7 +134,7 @@ def generator() -> Generator[AirbyteMessage, None, None]:
yield AirbyteMessage.model_validate_json(next_line)
except pydantic.ValidationError:
# Handle JSON decoding errors (optional)
raise ValueError("Invalid JSON format") # noqa: B904, TRY003
raise ValueError("Invalid JSON format") # noqa: B904

return cls(generator())

Expand All @@ -149,7 +149,7 @@ def generator() -> Generator[AirbyteMessage, None, None]:
yield AirbyteMessage.model_validate_json(line)
except pydantic.ValidationError:
# Handle JSON decoding errors (optional)
raise ValueError(f"Invalid JSON format in input string: {line}") # noqa: B904, TRY003
raise ValueError(f"Invalid JSON format in input string: {line}") # noqa: B904

return cls(generator())

Expand Down Expand Up @@ -193,6 +193,6 @@ def generator() -> Generator[AirbyteMessage, None, None]:
# Handle JSON decoding errors
current_file_buffer.close()
current_file_buffer = None
raise ValueError("Invalid JSON format") # noqa: B904, TRY003
raise ValueError("Invalid JSON format") # noqa: B904

return cls(generator())
2 changes: 1 addition & 1 deletion airbyte/_processors/sql/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class BigQueryTypeConverter(SQLTypeConverter):
@classmethod
def get_string_type(cls) -> sqlalchemy.types.TypeEngine:
"""Return the string type for BigQuery."""
return cast(sqlalchemy.types.TypeEngine, "String") # BigQuery uses STRING for all strings
return cast("sqlalchemy.types.TypeEngine", "String") # BigQuery uses STRING for all strings

@overrides
def to_sql_type(
Expand Down
Loading

0 comments on commit 5e472fc

Please sign in to comment.