singer_sdk.SQLSink¶
- class singer_sdk.SQLSink[source]¶
- SQL-type sink type. - activate_version(new_version)[source]¶
- Bump the active version of the target table. - Parameters:
- new_version (int) – The version number to activate. 
- Return type:
- None 
 
 - bulk_insert_records(full_table_name, schema, records)[source]¶
- Bulk insert records to an existing destination table. - The default implementation uses a generic SQLAlchemy bulk insert operation. This method may optionally be overridden by developers in order to provide faster, native bulk uploads. - Parameters:
- Returns:
- True if table exists, False if not, None if unsure or undetectable. 
- Return type:
- int | None 
 
 - conform_name(name, object_type=None)[source]¶
- Conform a stream property name to one suitable for the target system. - Transforms names to snake case by default, applicable to most common DBMSs’. Developers may override this method to apply custom transformations to database/schema/table/column names. 
 - generate_insert_statement(full_table_name, schema)[source]¶
- Generate an insert statement for the given records. 
 - merge_upsert_from_table(target_table_name, from_table_name, join_keys)[source]¶
- Merge upsert data from one table to another. - Parameters:
- Returns:
- The number of records copied, if detectable, or None if the API does not report number of records affected/inserted. 
- Raises:
- NotImplementedError – if the merge upsert capability does not exist or is undefined. 
- Return type:
- int | None 
 
 - process_batch(context)[source]¶
- Process a batch with the given batch context. - Writes a batch to the SQL target. Developers may override this method in order to provide a more efficient upload/upsert process. - Parameters:
- context (dict) – Stream partition or context dictionary. 
- Return type:
- None 
 
 - setup()[source]¶
- Set up Sink. - This method is called on Sink creation, and creates the required Schema and Table entities in the target database. - Return type:
- None 
 
 - property connection: Connection[source]¶
- Get or set the SQLAlchemy connection for this sink. - Returns:
- A connection object. 
 
 - property database_name: str | None[source]¶
- Return the DB name or None if using names with no database part. 
 - property full_schema_name: FullyQualifiedName[source]¶
- Return the fully qualified schema name. - Returns:
- The fully qualified schema name. 
 
 - property full_table_name: FullyQualifiedName[source]¶
- Return the fully qualified table name. - Returns:
- The fully qualified table name. 
 
 - property key_properties: Sequence[str][source]¶
- Return key properties, conformed to target system naming requirements. - Returns:
- A list of key properties, conformed with self.conform_name()