singer_sdk.InlineMapper#

class singer_sdk.InlineMapper#

Bases: PluginBase, SingerReader

Abstract base class for inline mappers.

__init__(*, config: dict | pathlib.PurePath | str | list[pathlib.PurePath | str] | None = None, parse_env_config: bool = False, validate_config: bool = True) None#

Create the tap or target.

Parameters:
  • config – May be one or more paths, either as str or PurePath objects, or it can be a predetermined config dict.

  • parse_env_config – True to parse settings from env vars.

  • validate_config – True to require validation of config settings.

Raises:

ValueError – If config is not a dict or path string.

classmethod append_builtin_config(config_jsonschema: dict) None#

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 – [description]

classmethod cb_version(ctx: Context, param: Option, value: bool) None#

CLI callback to print the plugin version and exit.

Parameters:
  • ctx – Click context.

  • param – Click parameter.

  • value – Boolean indicating whether to print the version.

property config: Mapping[str, Any]#

Get config.

Returns:

A frozen (read-only) config dictionary map.

static config_from_cli_args(*args: str) tuple[list[pathlib.Path], bool]#

Parse CLI arguments into a config dictionary.

Parameters:

args – CLI arguments.

Raises:

FileNotFoundError – If the config file does not exist.

Returns:

A tuple containing the config dictionary and a boolean indicating whether the config file was found.

classmethod get_plugin_version() str#

Return the package version number.

Returns:

The package version number.

classmethod get_sdk_version() str#

Return the package version number.

Returns:

The package version number.

classmethod get_singer_command() Command#

Execute standard CLI handler for inline mappers.

Returns:

A click.Command object.

classmethod invoke(*, about: bool = False, about_format: str | None = None, config: tuple[str, ...] = (), file_input: Optional[IO[str]] = None) None#

Invoke the mapper.

Parameters:
  • about – Display package metadata and settings.

  • about_format – Specify output style for –about.

  • config – Configuration file location or ‘ENV’ to use environment variables. Accepts multiple inputs as a tuple.

  • file_input – Optional file to read input from.

listen(file_input: Optional[IO[str]] = None) None#

Read from input until all messages are processed.

Parameters:

file_input – Readable stream of messages. Defaults to standard in.

This method is internal to the SDK and should not need to be overridden.

abstract map_activate_version_message(message_dict: dict) Iterable[Message]#

Map a version message to zero or more new messages.

Parameters:

message_dict – An ACTIVATE_VERSION message JSON dictionary.

map_batch_message(message_dict: dict) Iterable[Message]#

Map a batch message to zero or more new messages.

Parameters:

message_dict – A BATCH message JSON dictionary.

Raises:

NotImplementedError – if not implemented by subclass.

abstract map_record_message(message_dict: dict) Iterable[Message]#

Map a record message to zero or more new messages.

Parameters:

message_dict – A RECORD message JSON dictionary.

abstract map_schema_message(message_dict: dict) Iterable[Message]#

Map a schema message to zero or more new messages.

Parameters:

message_dict – A SCHEMA message JSON dictionary.

abstract map_state_message(message_dict: dict) Iterable[Message]#

Map a state message to zero or more new messages.

Parameters:

message_dict – A STATE message JSON dictionary.

classmethod print_about(output_format: str | None = None) None#

Print capabilities and other tap metadata.

Parameters:

output_format – Render option for the plugin information.

classmethod print_version(print_fn: ~typing.Callable[[~typing.Any], None] = <built-in function print>) None#

Print help text for the tap.

Parameters:

print_fn – A function to use to display the plugin version. Defaults to print.

property state: dict#

Get state.

Raises:

NotImplementedError – If the derived plugin doesn’t override this method.