singer_sdk.SQLStream

class singer_sdk.SQLStream

Base class for SQLAlchemy-based streams.

__init__(tap: TapBaseClass, catalog_entry: dict, connector: SQLConnector | None = None) None

Initialize the database stream.

If connector is omitted, a new connector will be created.

Parameters
  • tap – The parent tap object.

  • catalog_entry – Catalog entry dict.

  • connector – Optional connector to reuse.

property connector: SQLConnector

The connector object.

Returns

The connector object.

connector_class

alias of SQLConnector

property fully_qualified_name: str

Generate the fully qualified version of the table name.

Raises

ValueError – If table_name is not able to be detected.

Returns

The fully qualified name.

get_records(context: dict | None) Iterable[dict[str, Any]]

Return a generator of record-type dictionary objects.

If the stream has a replication_key value defined, records will be sorted by the incremental key. If the stream also has an available starting bookmark, the records will be filtered for values greater than or equal to the bookmark value.

Parameters

context – If partition context is provided, will read specifically from this data slice.

Yields

One dict per record.

Raises

NotImplementedError – If partition is passed in context and the stream does not support partitioning.

property metadata: MetadataMapping

The Singer metadata.

Metadata from an input catalog will override standard metadata.

Returns

Metadata object as specified in the Singer spec.

property primary_keys: list[str] | None

Get primary keys from the catalog entry definition.

Returns

A list of primary key(s) for the stream.

property schema: dict

Return metadata object (dict) as specified in the Singer spec.

Metadata from an input catalog will override standard metadata.

Returns

The schema object.

property tap_stream_id: str

Return the unique ID used by the tap to identify this stream.

Generally, this is the same value as in Stream.name.

In rare cases, such as for database types with multi-part names, this may be slightly different from Stream.name.

Returns

The unique tap stream ID as a string.