Skip to content

Commit

Permalink
Feat: Add destinations support (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronsteers authored Jul 30, 2024
1 parent caa0279 commit 4591a6d
Show file tree
Hide file tree
Showing 72 changed files with 4,213 additions and 1,728 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# temp files
temp
.temp

# logs
logs/

# Viztracer log files
viztracer_report.json

Expand Down
9 changes: 8 additions & 1 deletion airbyte/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
caches,
cloud,
datasets,
destinations,
documents,
exceptions, # noqa: ICN001 # No 'exc' alias for top-level module
experimental,
Expand All @@ -25,8 +26,10 @@
from airbyte.caches.duckdb import DuckDBCache
from airbyte.caches.util import get_default_cache, new_local_cache
from airbyte.datasets import CachedDataset
from airbyte.destinations.base import Destination
from airbyte.destinations.util import get_destination
from airbyte.records import StreamRecord
from airbyte.results import ReadResult
from airbyte.results import ReadResult, WriteResult
from airbyte.secrets import SecretSourceEnum, get_secret
from airbyte.sources import registry
from airbyte.sources.base import Source
Expand All @@ -39,6 +42,7 @@
"cloud",
"caches",
"datasets",
"destinations",
"documents",
"exceptions",
"experimental",
Expand All @@ -50,17 +54,20 @@
# Factories
"get_available_connectors",
"get_default_cache",
"get_destination",
"get_secret",
"get_source",
"new_local_cache",
# Classes
"BigQueryCache",
"CachedDataset",
"Destination",
"DuckDBCache",
"ReadResult",
"SecretSourceEnum",
"Source",
"StreamRecord",
"WriteResult",
]

__docformat__ = "google"
6 changes: 3 additions & 3 deletions airbyte/_batch_handles.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ def __init__(
stream_name: str,
batch_id: str,
files: list[Path],
file_opener: Callable[[Path], IO[bytes]],
file_opener: Callable[[Path], IO[str]],
) -> None:
"""Initialize the batch handle."""
self._stream_name = stream_name
self._batch_id = batch_id
self._files = files
self._record_count = 0
assert self._files, "A batch must have at least one file."
self._open_file_writer: IO[bytes] = file_opener(self._files[0])
self._open_file_writer: IO[str] = file_opener(self._files[0])

# Marker for whether the batch has been finalized.
self.finalized: bool = False
Expand Down Expand Up @@ -57,7 +57,7 @@ def increment_record_count(self) -> None:
self._record_count += 1

@property
def open_file_writer(self) -> IO[bytes] | None:
def open_file_writer(self) -> IO[str] | None:
"""Return the open file writer, if any, or None."""
return self._open_file_writer

Expand Down
Loading

0 comments on commit 4591a6d

Please sign in to comment.