singer_sdk.Tap

class singer_sdk.Tap(config: Optional[Union[dict, pathlib.PurePath, str, List[Union[pathlib.PurePath, str]]]] = None, catalog: Optional[Union[pathlib.PurePath, str, dict]] = None, state: Optional[Union[pathlib.PurePath, str, dict]] = None, parse_env_config: bool = False, validate_config: bool = True)

Abstract base class for taps.

The Tap class governs configuration, validation, and stream discovery for tap plugins.

property catalog_dict

Get catalog dictionary.

Returns

The tap’s catalog as a dict

property catalog_json_text

Get catalog JSON.

Returns

The tap’s catalog as formatted JSON text.

cli = <Command cli>
discover_streams()List[singer_sdk.streams.core.Stream]

Initialize all available streams and return them as a list.

Raises

NotImplementedError – If the tap implementation does not override this method.

property input_catalog

Get the catalog passed to the tap.

Returns

Catalog dictionary input, or None if not provided.

load_state(state: Dict[str, Any])None

Merge or initialize stream state with the provided state dictionary input.

Override this method to perform validation and backwards-compatibility patches on self.state. If overriding, we recommend first running super().load_state(state) to ensure compatibility with the SDK.

Parameters

state – Initialize the tap’ss state with this value.

Raises

ValueError – If the tap’s own state is None, meaning it has not been initialized.

load_streams()List[singer_sdk.streams.core.Stream]

Load streams from discovery and initialize DAG.

Return the output of self.discover_streams() to enumerate discovered streams.

Returns

A list of discovered streams, ordered by name.

run_connection_test()bool

Run connection test.

Returns

True if the test succeeded.

run_discovery()str

Write the catalog json to STDOUT and return as a string.

Returns

The catalog as a string of JSON.

property state

Get tap state.

Returns

The tap’s state dictionary

Raises

RuntimeError – If state has not been initialized.

property streams

Get streams discovered or catalogued for this tap.

Results will be cached after first execution.

Returns

A mapping of names to streams, using discovery or a provided catalog.

sync_all()None

Sync all streams.