Submodules

airbyte_cdk.sources.declarative.schema.json_schema module

airbyte_cdk.sources.declarative.schema.schema_loader module

class airbyte_cdk.sources.declarative.schema.schema_loader.SchemaLoader

Bases: object

Describes a stream’s schema

abstract get_json_schema() Mapping[str, Any]

Returns a mapping describing the stream’s schema

Module contents

class airbyte_cdk.sources.declarative.schema.DefaultSchemaLoader(config: Mapping[str, Any], parameters: dataclasses.InitVar[Mapping[str, Any]])

Bases: airbyte_cdk.sources.declarative.schema.schema_loader.SchemaLoader

Loads a schema from the default location or returns an empty schema for streams that have not defined their schema file yet.

config

The user-provided configuration as specified by the source’s spec

Type

Config

parameters

Additional arguments to pass to the string interpolation if needed

Type

Mapping[str, Any]

config: Mapping[str, Any]
get_json_schema() Mapping[str, Any]

Attempts to retrieve a schema from the default filepath location or returns the empty schema if a schema cannot be found.

Returns

The empty schema

parameters: dataclasses.InitVar[Mapping[str, Any]]
class airbyte_cdk.sources.declarative.schema.InlineSchemaLoader(schema: Dict[str, Any], parameters: dataclasses.InitVar[Mapping[str, Any]])

Bases: airbyte_cdk.sources.declarative.schema.schema_loader.SchemaLoader

Describes a stream’s schema

get_json_schema() Mapping[str, Any]

Returns a mapping describing the stream’s schema

parameters: dataclasses.InitVar[Mapping[str, Any]]
schema: Dict[str, Any]
class airbyte_cdk.sources.declarative.schema.JsonFileSchemaLoader(config: Mapping[str, Any], parameters: dataclasses.InitVar[Mapping[str, Any]], file_path: Optional[Union[airbyte_cdk.sources.declarative.interpolation.interpolated_string.InterpolatedString, str]] = None)

Bases: airbyte_cdk.sources.utils.schema_helpers.ResourceSchemaLoader, airbyte_cdk.sources.declarative.schema.schema_loader.SchemaLoader

Loads the schema from a json file

file_path

The path to the json file describing the schema

Type

Union[InterpolatedString, str]

name

The stream’s name

Type

str

config

The user-provided configuration as specified by the source’s spec

Type

Config

parameters

Additional arguments to pass to the string interpolation if needed

Type

Mapping[str, Any]

config: Mapping[str, Any]
static extract_resource_and_schema_path(json_schema_path: str) -> (<class 'str'>, <class 'str'>)

When the connector is running on a docker container, package_data is accessible from the resource (source_<name>), so we extract the resource from the first part of the schema path and the remaining path is used to find the schema file. This is a slight hack to identify the source name while we are in the airbyte_cdk module. :param json_schema_path: The path to the schema JSON file :return: Tuple of the resource name and the path to the schema file

file_path: Union[airbyte_cdk.sources.declarative.interpolation.interpolated_string.InterpolatedString, str] = None
get_json_schema() Mapping[str, Any]

Returns a mapping describing the stream’s schema

parameters: dataclasses.InitVar[Mapping[str, Any]]
class airbyte_cdk.sources.declarative.schema.SchemaLoader

Bases: object

Describes a stream’s schema

abstract get_json_schema() Mapping[str, Any]

Returns a mapping describing the stream’s schema