Skip to content

Commit

Permalink
feat(taps): Abstract streams
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Feb 26, 2025
1 parent 57a9bb4 commit 5fc6499
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions singer_sdk/streams/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ class Stream(metaclass=abc.ABCMeta): # noqa: PLR0904
selected_by_default: bool = True
"""Whether this stream is selected by default in the catalog."""

__abstract__: bool = False
"""Flag to indicate this stream is abstract and will not generate a catalog entry.""" # noqa: E501

def __init__(
self,
tap: Tap,
Expand Down Expand Up @@ -321,6 +324,9 @@ def selected(self) -> bool:
Returns:
True if the stream is selected.
"""
if self.__abstract__:
return self.has_selected_descendents

Check warning on line 328 in singer_sdk/streams/core.py

View check run for this annotation

Codecov / codecov/patch

singer_sdk/streams/core.py#L328

Added line #L328 was not covered by tests

return self.mask.get((), True)

@selected.setter
Expand Down
1 change: 1 addition & 0 deletions singer_sdk/tap_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ def _singer_catalog(self) -> Catalog:
return Catalog(
(stream.tap_stream_id, stream._singer_catalog_entry) # noqa: SLF001
for stream in self.streams.values()
if not stream.__abstract__
)

def discover_streams(self) -> t.Sequence[Stream]:
Expand Down

0 comments on commit 5fc6499

Please sign in to comment.