Subpackages

Submodules

airbyte_cdk.connector module

class airbyte_cdk.connector.AirbyteSpec(spec_string)

Bases: object

static from_file(file_name: str)
class airbyte_cdk.connector.BaseConnector

Bases: abc.ABC, Generic[airbyte_cdk.connector.TConfig]

abstract check(logger: logging.Logger, config: airbyte_cdk.connector.TConfig) airbyte_protocol.models.airbyte_protocol.AirbyteConnectionStatus

Tests if the input configuration can be used to successfully connect to the integration e.g: if a provided Stripe API token can be used to connect to the Stripe API.

check_config_against_spec: bool = True
abstract configure(config: Mapping[str, Any], temp_dir: str) airbyte_cdk.connector.TConfig

Persist config in temporary directory to run the Source job

static read_config(config_path: str) Mapping[str, Any]
spec(logger: logging.Logger) airbyte_protocol.models.airbyte_protocol.ConnectorSpecification

Returns the spec for this integration. The spec is a JSON-Schema object describing the required configurations (e.g: username and password) required to run this integration. By default, this will be loaded from a “spec.yaml” or a “spec.json” in the package root.

static write_config(config: airbyte_cdk.connector.TConfig, config_path: str)
class airbyte_cdk.connector.Connector

Bases: airbyte_cdk.connector.DefaultConnectorMixin, airbyte_cdk.connector.BaseConnector[Mapping[str, Any]], abc.ABC

class airbyte_cdk.connector.DefaultConnectorMixin

Bases: object

configure(config: Mapping[str, Any], temp_dir: str) Mapping[str, Any]
airbyte_cdk.connector.load_optional_package_file(package: str, filename: str) Optional[bytes]

Gets a resource from a package, returning None if it does not exist

airbyte_cdk.entrypoint module

class airbyte_cdk.entrypoint.AirbyteEntrypoint(source: airbyte_cdk.sources.source.Source)

Bases: object

static airbyte_message_to_string(airbyte_message: airbyte_protocol.models.airbyte_protocol.AirbyteMessage) Any
check(source_spec: airbyte_protocol.models.airbyte_protocol.ConnectorSpecification, config: airbyte_cdk.connector.TConfig) Iterable[airbyte_protocol.models.airbyte_protocol.AirbyteMessage]
discover(source_spec: airbyte_protocol.models.airbyte_protocol.ConnectorSpecification, config: airbyte_cdk.connector.TConfig) Iterable[airbyte_protocol.models.airbyte_protocol.AirbyteMessage]
classmethod extract_catalog(args: List[str]) Optional[Any]
classmethod extract_config(args: List[str]) Optional[Any]
classmethod extract_state(args: List[str]) Optional[Any]
static parse_args(args: List[str]) argparse.Namespace
read(source_spec: airbyte_protocol.models.airbyte_protocol.ConnectorSpecification, config: airbyte_cdk.connector.TConfig, catalog: Any, state: Union[list[Any], MutableMapping[str, Any]]) Iterable[airbyte_protocol.models.airbyte_protocol.AirbyteMessage]
run(parsed_args: argparse.Namespace) Iterable[str]
static set_up_secret_filter(config: airbyte_cdk.connector.TConfig, connection_specification: Mapping[str, Any]) None
static validate_connection(source_spec: airbyte_protocol.models.airbyte_protocol.ConnectorSpecification, config: airbyte_cdk.connector.TConfig) None
airbyte_cdk.entrypoint.launch(source: airbyte_cdk.sources.source.Source, args: List[str]) None
airbyte_cdk.entrypoint.main() None

airbyte_cdk.exception_handler module

airbyte_cdk.exception_handler.assemble_uncaught_exception(exception_type: type[BaseException], exception_value: BaseException) airbyte_cdk.utils.traced_exception.AirbyteTracedException
airbyte_cdk.exception_handler.init_uncaught_exception_handler(logger: logging.Logger) None

Handles uncaught exceptions by emitting an AirbyteTraceMessage and making sure they are not printed to the console without having secrets removed.

airbyte_cdk.logger module

class airbyte_cdk.logger.AirbyteLogFormatter(fmt=None, datefmt=None, style='%', validate=True)

Bases: logging.Formatter

Output log records using AirbyteMessage

static extract_extra_args_from_record(record: logging.LogRecord)

The python logger conflates default args with extra args. We use an empty log record and set operations to isolate fields passed to the log record via extra by the developer.

format(record: logging.LogRecord) str

Return a JSON representation of the log message

level_mapping = {10: 'DEBUG', 20: 'INFO', 30: 'WARN', 40: 'ERROR', 50: 'FATAL'}
class airbyte_cdk.logger.AirbyteLogger(*args, **kwargs)

Bases: object

debug(message)
error(message)
exception(message)
fatal(message)
info(message)
log(level, message)
trace(message)
warn(message)
airbyte_cdk.logger.init_logger(name: Optional[str] = None)

Initial set up of logger

airbyte_cdk.logger.log_by_prefix(msg: str, default_level: str) Tuple[int, str]

Custom method, which takes log level from first word of message

Module contents

class airbyte_cdk.AirbyteEntrypoint(source: airbyte_cdk.sources.source.Source)

Bases: object

static airbyte_message_to_string(airbyte_message: airbyte_protocol.models.airbyte_protocol.AirbyteMessage) Any
check(source_spec: airbyte_protocol.models.airbyte_protocol.ConnectorSpecification, config: airbyte_cdk.connector.TConfig) Iterable[airbyte_protocol.models.airbyte_protocol.AirbyteMessage]
discover(source_spec: airbyte_protocol.models.airbyte_protocol.ConnectorSpecification, config: airbyte_cdk.connector.TConfig) Iterable[airbyte_protocol.models.airbyte_protocol.AirbyteMessage]
classmethod extract_catalog(args: List[str]) Optional[Any]
classmethod extract_config(args: List[str]) Optional[Any]
classmethod extract_state(args: List[str]) Optional[Any]
static parse_args(args: List[str]) argparse.Namespace
read(source_spec: airbyte_protocol.models.airbyte_protocol.ConnectorSpecification, config: airbyte_cdk.connector.TConfig, catalog: Any, state: Union[list[Any], MutableMapping[str, Any]]) Iterable[airbyte_protocol.models.airbyte_protocol.AirbyteMessage]
run(parsed_args: argparse.Namespace) Iterable[str]
static set_up_secret_filter(config: airbyte_cdk.connector.TConfig, connection_specification: Mapping[str, Any]) None
static validate_connection(source_spec: airbyte_protocol.models.airbyte_protocol.ConnectorSpecification, config: airbyte_cdk.connector.TConfig) None
class airbyte_cdk.AirbyteLogger(*args, **kwargs)

Bases: object

debug(message)
error(message)
exception(message)
fatal(message)
info(message)
log(level, message)
trace(message)
warn(message)
class airbyte_cdk.AirbyteSpec(spec_string)

Bases: object

static from_file(file_name: str)
class airbyte_cdk.Connector

Bases: airbyte_cdk.connector.DefaultConnectorMixin, airbyte_cdk.connector.BaseConnector[Mapping[str, Any]], abc.ABC