Submodules

airbyte_cdk.sources.declarative.datetime.datetime_parser module

class airbyte_cdk.sources.declarative.datetime.datetime_parser.DatetimeParser

Bases: object

Parses and formats datetime objects according to a specified format.

This class mainly acts as a wrapper to properly handling timestamp formatting through the “%s” directive.

%s is part of the list of format codes required by the 1989 C standard, but it is unreliable because it always return a datetime in the system’s timezone. Instead of using the directive directly, we can use datetime.fromtimestamp and dt.timestamp()

format(dt: datetime.datetime, format: str) str
parse(date: Union[str, int], format: str) datetime.datetime

airbyte_cdk.sources.declarative.datetime.min_max_datetime module

class airbyte_cdk.sources.declarative.datetime.min_max_datetime.MinMaxDatetime(datetime: typing.Union[airbyte_cdk.sources.declarative.interpolation.interpolated_string.InterpolatedString, str], parameters: dataclasses.InitVar[typing.Mapping[str, typing.Any]], datetime_format: str = <property object>, min_datetime: typing.Union[airbyte_cdk.sources.declarative.interpolation.interpolated_string.InterpolatedString, str] = '', max_datetime: typing.Union[airbyte_cdk.sources.declarative.interpolation.interpolated_string.InterpolatedString, str] = '')

Bases: object

Compares the provided date against optional minimum or maximum times. If date is earlier than min_date, then min_date is returned. If date is greater than max_date, then max_date is returned. If neither, the input date is returned.

The timestamp format accepts the same format codes as datetime.strfptime, which are all the format codes required by the 1989 C standard. Full list of accepted format codes: https://man7.org/linux/man-pages/man3/strftime.3.html

datetime

InterpolatedString or string representing the datetime in the format specified by datetime_format

Type

Union[InterpolatedString, str]

datetime_format

Format of the datetime passed as argument

Type

str

min_datetime

Represents the minimum allowed datetime value.

Type

Union[InterpolatedString, str]

max_datetime

Represents the maximum allowed datetime value.

Type

Union[InterpolatedString, str]

datetime: Union[airbyte_cdk.sources.declarative.interpolation.interpolated_string.InterpolatedString, str]
property datetime_format: str

The format of the string representing the datetime

get_datetime(config, **additional_parameters) datetime.datetime

Evaluates and returns the datetime :param config: The user-provided configuration as specified by the source’s spec :param additional_parameters: Additional arguments to be passed to the strings for interpolation :return: The evaluated datetime

max_datetime: Union[airbyte_cdk.sources.declarative.interpolation.interpolated_string.InterpolatedString, str] = ''
min_datetime: Union[airbyte_cdk.sources.declarative.interpolation.interpolated_string.InterpolatedString, str] = ''
parameters: dataclasses.InitVar[Mapping[str, Any]]

Module contents

class airbyte_cdk.sources.declarative.datetime.MinMaxDatetime(datetime: typing.Union[airbyte_cdk.sources.declarative.interpolation.interpolated_string.InterpolatedString, str], parameters: dataclasses.InitVar[typing.Mapping[str, typing.Any]], datetime_format: str = <property object>, min_datetime: typing.Union[airbyte_cdk.sources.declarative.interpolation.interpolated_string.InterpolatedString, str] = '', max_datetime: typing.Union[airbyte_cdk.sources.declarative.interpolation.interpolated_string.InterpolatedString, str] = '')

Bases: object

Compares the provided date against optional minimum or maximum times. If date is earlier than min_date, then min_date is returned. If date is greater than max_date, then max_date is returned. If neither, the input date is returned.

The timestamp format accepts the same format codes as datetime.strfptime, which are all the format codes required by the 1989 C standard. Full list of accepted format codes: https://man7.org/linux/man-pages/man3/strftime.3.html

datetime

InterpolatedString or string representing the datetime in the format specified by datetime_format

Type

Union[InterpolatedString, str]

datetime_format

Format of the datetime passed as argument

Type

str

min_datetime

Represents the minimum allowed datetime value.

Type

Union[InterpolatedString, str]

max_datetime

Represents the maximum allowed datetime value.

Type

Union[InterpolatedString, str]

datetime: Union[airbyte_cdk.sources.declarative.interpolation.interpolated_string.InterpolatedString, str]
property datetime_format: str

The format of the string representing the datetime

get_datetime(config, **additional_parameters) datetime.datetime

Evaluates and returns the datetime :param config: The user-provided configuration as specified by the source’s spec :param additional_parameters: Additional arguments to be passed to the strings for interpolation :return: The evaluated datetime

max_datetime: Union[airbyte_cdk.sources.declarative.interpolation.interpolated_string.InterpolatedString, str] = ''
min_datetime: Union[airbyte_cdk.sources.declarative.interpolation.interpolated_string.InterpolatedString, str] = ''
parameters: dataclasses.InitVar[Mapping[str, Any]]