singer_sdk.SQLTarget¶
- class singer_sdk.SQLTarget[source]¶
Bases:
Target
Target implementation for SQL destinations.
- __init__(*, config=None, parse_env_config=False, validate_config=True, setup_mapper=True)[source]¶
Initialize the target.
- Parameters:
config (dict | PurePath | str | list[PurePath | str] | None) – Target configuration. Can be a dictionary, a single path to a configuration file, or a list of paths to multiple configuration files.
parse_env_config (bool) – Whether to look for configuration values in environment variables.
validate_config (bool) – True to require validation of config settings.
setup_mapper (bool) – True to setup the mapper. Set to False if you want to
- Return type:
None
- add_sink(stream_name, schema, key_properties=None)[source]¶
Create a sink and register it.
This method is internal to the SDK and should not need to be overridden.
- final add_sqlsink(stream_name, schema, key_properties=None)[source]¶
Create a sink and register it.
This method is internal to the SDK and should not need to be overridden.
- classmethod append_builtin_config(config_jsonschema)[source]¶
Appends built-in config to config_jsonschema if not already set.
To customize or disable this behavior, developers may either override this class method or override the capabilities property to disabled any unwanted built-in capabilities.
For all except very advanced use cases, we recommend leaving these implementations “as-is”, since this provides the most choice to users and is the most “future proof” in terms of taking advantage of built-in capabilities which may be added in the future.
- Parameters:
config_jsonschema (dict) – [description]
- Return type:
None
- classmethod cb_version(ctx, param, value)[source]¶
CLI callback to print the plugin version and exit.
- Parameters:
ctx (Context) – Click context.
param (Option) – Click parameter.
value (bool) – Boolean indicating whether to print the version.
- Return type:
None
- drain_all(*, is_endofpipe=False)[source]¶
Drains all sinks, starting with those cleared due to changed schema.
This method is internal to the SDK and should not need to be overridden.
- Parameters:
is_endofpipe (bool) – This is passed by the
_process_endofpipe()
which is called after the target instance has finished listening to the stdin- Return type:
None
- drain_one(sink)[source]¶
Drain a specific sink.
This method is internal to the SDK and should not need to be overridden.
- Parameters:
sink (Sink) – Sink to be drained.
- Return type:
None
- classmethod get_plugin_version()[source]¶
Return the package version number.
- Returns:
The package version number.
- Return type:
- classmethod get_sdk_version()[source]¶
Return the package version number.
- Returns:
The package version number.
- Return type:
- classmethod get_singer_command()[source]¶
Execute standard CLI handler for taps.
- Returns:
A click.Command object.
- Return type:
Command
- get_sink(stream_name, *, record=None, schema=None, key_properties=None)[source]¶
Return a sink for the given stream name.
A new sink will be created if schema is provided and if either schema or key_properties has changed. If so, the old sink becomes archived and held until the next drain_all() operation.
Developers only need to override this method if they want to provide a different sink depending on the values within the record object. Otherwise, please see default_sink_class property and/or the get_sink_class() method.
Raises
singer_sdk.exceptions.RecordsWithoutSchemaException
if sink does not exist and schema is not sent.
- get_sink_class(stream_name)[source]¶
Get sink for a stream.
Developers can override this method to return a custom Sink type depending on the value of stream_name. Optional when default_sink_class is set.
- Parameters:
stream_name (str) – Name of the stream.
- Raises:
ValueError – If no
singer_sdk.sinks.Sink
class is defined.- Returns:
The sink class to be used with the stream.
- Return type:
- classmethod invoke(*, about=False, about_format=None, config=(), file_input=None)[source]¶
Invoke the target.
- Parameters:
about (bool) – Display package metadata and settings.
about_format (str | None) – Specify output style for –about.
config (tuple[str, ...]) – Configuration file location or ‘ENV’ to use environment variables. Accepts multiple inputs as a tuple.
file_input (IO[str] | None) – Optional file to read input from.
- Return type:
None
- listen(file_input=None)[source]¶
Read from input until all messages are processed.
- Parameters:
file_input (IO[T] | None) – Readable stream of messages. Defaults to standard in.
- Return type:
None
- classmethod print_about(output_format=None)[source]¶
Print capabilities and other tap metadata.
- Parameters:
output_format (str | None) – Render option for the plugin information.
- Return type:
None
- sink_exists(stream_name)[source]¶
Check sink for a stream.
This method is internal to the SDK and should not need to be overridden.
- property config: Mapping[str, Any][source]¶
Get config.
- Returns:
A frozen (read-only) config dictionary map.
- property initialized_at: int[source]¶
Start time of the plugin.
- Returns:
The start time of the plugin.
- property mapper: PluginMapper[source]¶
Plugin mapper for this tap.
- Returns:
A PluginMapper object.
- Raises:
MapperNotInitialized – If the mapper has not been initialized.
- property max_parallelism: int[source]¶
Get max parallel sinks.
The default is 8 if not overridden.
- Returns:
Max number of sinks that can be drained in parallel.
- property state: dict[source]¶
Get state.
- Raises:
NotImplementedError – If the derived plugin doesn’t override this method.
- property target_connector: SQLConnector[source]¶
The connector object.
- Returns:
The connector object.