Customization#

big_corporation_inc.id_translation.customization

Custom implementations may be used to change behavior in ways that TOML configuration alone does not permit.

Classes

CustomSqlFetcher(connection_string[, ...])

A custom SqlFetcher for Big Corporation Inc. databases.

CustomTranslator([fetcher, fmt, mapper, ...])

class CustomTranslator(fetcher=None, fmt='{id}:{name}', mapper=None, default_fmt='<Failed: id={id!r}>', default_fmt_placeholders=None, enable_uuid_heuristics=False, transformers=None)#

Bases: Translator[NameType, SourceType, IdType]

classmethod from_config(*args, **kwargs)#

Create a Translator from TOML inputs.

See Configuration for help.

Parameters:
  • path – Path to the main TOML configuration file.

  • extra_fetchers – Paths to fetching configuration TOML files. If multiple fetchers are defined, they are ranked by input order. If a fetcher defined in the main configuration, it will be prioritized (rank=0).

Returns:

A new Translator instance with a config_metadata attribute.

class CustomSqlFetcher(connection_string, password=None, whitelist_tables=None, blacklist_tables=(), schema=None, include_views=False, engine_kwargs=None, **kwargs)#

Bases: SqlFetcher[IdType]

A custom SqlFetcher for Big Corporation Inc. databases.

Reads the database password from AWS and filters queries based on an ‘enabled’ status flag.

classmethod parse_connection_string(connection_string, arn)#

Finalize the connection string by reading the password from AWS.

select_where(select, *, ids, id_column, table)#

Restrict every query to rows flagged as enabled.