singer_sdk.SQLStream¶
- class singer_sdk.SQLStream[source]¶
Base class for SQLAlchemy-based streams.
- connector_class[source]¶
alias of
SQLConnector
- __init__(tap, catalog_entry, connector=None)[source]¶
Initialize the database stream.
If connector is omitted, a new connector will be created.
- Parameters:
tap (Tap) – The parent tap object.
catalog_entry (dict) – Catalog entry dict.
connector (SQLConnector | None) – Optional connector to reuse.
- Return type:
None
- get_records(context)[source]¶
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 (Context | None) – 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.
- Return type:
- get_selected_schema()[source]¶
Return a copy of the Stream JSON schema, dropping any fields not selected.
- Returns:
A dictionary containing a copy of the Stream JSON schema, filtered to any selection criteria.
- Return type:
- property connector: SQLConnector[source]¶
Return a connector object.
- Returns:
The connector object.
- property fully_qualified_name: FullyQualifiedName[source]¶
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.
- property is_sorted: bool[source]¶
Expect stream to be sorted.
When True, incremental streams will attempt to resume if unexpectedly interrupted.
- Returns:
True if stream is sorted. Defaults to False.
- property metadata: MetadataMapping[source]¶
Return the Singer metadata.
Metadata from an input catalog will override standard metadata.
- Returns:
Metadata object as specified in the Singer spec.
- property primary_keys: Sequence[str] | None[source]¶
Get primary keys from the catalog entry definition.
- Returns:
A list of primary key(s) for the stream.
- property schema: dict[source]¶
Return metadata object (dict) as specified in the Singer spec.
Metadata from an input catalog will override standard metadata.
- Returns:
The schema object.
- supports_nulls_first: bool = False[source]¶
Whether the database supports the NULLS FIRST/LAST syntax.
- property tap_stream_id: str[source]¶
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.