-
Notifications
You must be signed in to change notification settings - Fork 67
feat: Add stream previews for sources #725
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
1576dfb
feat: add column_names property to datasets
aaronsteers 1a9e5a7
feat: add in-memory dataset and fetch_all() for lazy datasets
aaronsteers 6a655cd
feat: add 'limit' arg to `Source.get_records()`
aaronsteers ae0ec07
feat: add get_samples() and print_samples() for `Source` class
aaronsteers 696c865
examples: add scripts for faker and github
aaronsteers aa3e5d7
add stop event, error handling
aaronsteers f3a5e5b
Merge branch 'main' into aj/feat/stream-previews
aaronsteers 1096cdb
fix telemetry
aaronsteers f570a5b
misc fixes
aaronsteers 368c382
Merge branch 'main' into aj/feat/stream-previews
aaronsteers fff994e
fix stop event
aaronsteers f0d90f7
fix: Replace pendulum with ab_datetime_now() and fix linting issues (…
aaronsteers 6d85713
fix: Improve stop event coordination to reduce BrokenPipeError warnings
devin-ai-integration[bot] bbf06e6
Merge branch 'main' into aj/feat/stream-previews
aaronsteers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,45 @@ | ||
# Copyright (c) 2023 Airbyte, Inc., all rights reserved. | ||
"""In-memory dataset class.""" | ||
|
||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING, Any | ||
|
||
from overrides import overrides | ||
|
||
from airbyte.datasets import DatasetBase | ||
|
||
|
||
if TYPE_CHECKING: | ||
from collections.abc import Iterator | ||
|
||
from airbyte_protocol.models import ConfiguredAirbyteStream | ||
|
||
|
||
class InMemoryDataset(DatasetBase): | ||
"""A dataset that is held in memory. | ||
|
||
This dataset is useful for testing and debugging purposes, but should not be used with any | ||
large datasets. | ||
""" | ||
|
||
def __init__( | ||
self, | ||
records: list[dict[str, Any]], | ||
stream_metadata: ConfiguredAirbyteStream, | ||
) -> None: | ||
"""Initialize the dataset with a list of records.""" | ||
# Should already be a list, but we convert it to a list just in case an iterator is passed. | ||
self._records: list[dict[str, Any]] = list(records) | ||
super().__init__( | ||
stream_metadata=stream_metadata, | ||
) | ||
|
||
@overrides | ||
def __iter__(self) -> Iterator[dict[str, Any]]: | ||
"""Return the iterator of records.""" | ||
return iter(self._records) | ||
|
||
def __len__(self) -> int: | ||
"""Return the number of records in the dataset.""" | ||
return len(self._records) |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.