Skip to content
4 changes: 2 additions & 2 deletions airbyte_cdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
from .connector import BaseConnector, Connector
from .destinations import Destination
from .entrypoint import AirbyteEntrypoint, launch
from .legacy.sources.declarative.declarative_stream import DeclarativeStream
from .legacy.sources.declarative.incremental import DatetimeBasedCursor
from .logger import AirbyteLogFormatter, init_logger
from .models import (
AdvancedAuth,
Expand Down Expand Up @@ -99,13 +101,11 @@
BearerAuthenticator,
)
from .sources.declarative.datetime.min_max_datetime import MinMaxDatetime
from .sources.declarative.declarative_stream import DeclarativeStream
from .sources.declarative.decoders import Decoder, JsonDecoder
from .sources.declarative.exceptions import ReadException
from .sources.declarative.extractors import DpathExtractor, RecordSelector
from .sources.declarative.extractors.record_extractor import RecordExtractor
from .sources.declarative.extractors.record_filter import RecordFilter
from .sources.declarative.incremental import DatetimeBasedCursor
from .sources.declarative.interpolation import InterpolatedBoolean, InterpolatedString
from .sources.declarative.migrations.legacy_to_per_partition_state_migration import (
LegacyToPerPartitionStateMigration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
from dataclasses import InitVar, dataclass, field
from typing import Any, Iterable, List, Mapping, MutableMapping, Optional, Union

from airbyte_cdk.models import SyncMode
from airbyte_cdk.sources.declarative.incremental import (
from airbyte_cdk.legacy.sources.declarative.incremental import (
GlobalSubstreamCursor,
PerPartitionCursor,
PerPartitionWithGlobalCursor,
)
from airbyte_cdk.models import SyncMode
from airbyte_cdk.sources.declarative.interpolation import InterpolatedString
from airbyte_cdk.sources.declarative.migrations.state_migration import StateMigration
from airbyte_cdk.sources.declarative.retrievers import SimpleRetriever
Expand Down
30 changes: 30 additions & 0 deletions airbyte_cdk/legacy/sources/declarative/incremental/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
# Copyright (c) 2025 Airbyte, Inc., all rights reserved.

from airbyte_cdk.legacy.sources.declarative.incremental.datetime_based_cursor import (
DatetimeBasedCursor,
)
from airbyte_cdk.legacy.sources.declarative.incremental.declarative_cursor import DeclarativeCursor
from airbyte_cdk.legacy.sources.declarative.incremental.global_substream_cursor import (
GlobalSubstreamCursor,
)
from airbyte_cdk.legacy.sources.declarative.incremental.per_partition_cursor import (
CursorFactory,
PerPartitionCursor,
)
from airbyte_cdk.legacy.sources.declarative.incremental.per_partition_with_global import (
PerPartitionWithGlobalCursor,
)
from airbyte_cdk.legacy.sources.declarative.incremental.resumable_full_refresh_cursor import (
ChildPartitionResumableFullRefreshCursor,
ResumableFullRefreshCursor,
)

__all__ = [
"CursorFactory",
"DatetimeBasedCursor",
"DeclarativeCursor",
"GlobalSubstreamCursor",
"PerPartitionCursor",
"PerPartitionWithGlobalCursor",
"ResumableFullRefreshCursor",
"ChildPartitionResumableFullRefreshCursor",
]
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

from isodate import Duration, duration_isoformat, parse_duration

from airbyte_cdk.legacy.sources.declarative.incremental.declarative_cursor import DeclarativeCursor
from airbyte_cdk.models import AirbyteLogMessage, AirbyteMessage, Level, Type
from airbyte_cdk.sources.declarative.datetime.datetime_parser import DatetimeParser
from airbyte_cdk.sources.declarative.datetime.min_max_datetime import MinMaxDatetime
from airbyte_cdk.sources.declarative.incremental.declarative_cursor import DeclarativeCursor
from airbyte_cdk.sources.declarative.interpolation.interpolated_string import InterpolatedString
from airbyte_cdk.sources.declarative.interpolation.jinja import JinjaInterpolation
from airbyte_cdk.sources.declarative.requesters.request_option import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
import time
from typing import Any, Callable, Iterable, Mapping, Optional, TypeVar, Union

from airbyte_cdk.sources.declarative.incremental.datetime_based_cursor import DatetimeBasedCursor
from airbyte_cdk.sources.declarative.incremental.declarative_cursor import DeclarativeCursor
from airbyte_cdk.legacy.sources.declarative.incremental.datetime_based_cursor import (
DatetimeBasedCursor,
)
from airbyte_cdk.legacy.sources.declarative.incremental.declarative_cursor import DeclarativeCursor
from airbyte_cdk.sources.declarative.partition_routers.partition_router import PartitionRouter
from airbyte_cdk.sources.types import Record, StreamSlice, StreamState

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from collections import OrderedDict
from typing import Any, Callable, Iterable, Mapping, Optional, Union

from airbyte_cdk.sources.declarative.incremental.declarative_cursor import DeclarativeCursor
from airbyte_cdk.legacy.sources.declarative.incremental.declarative_cursor import DeclarativeCursor
from airbyte_cdk.sources.declarative.partition_routers.partition_router import PartitionRouter
from airbyte_cdk.sources.streams.checkpoint.per_partition_key_serializer import (
PerPartitionKeySerializer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
#
from typing import Any, Iterable, Mapping, MutableMapping, Optional, Union

from airbyte_cdk.legacy.sources.declarative.incremental.per_partition_cursor import (
CursorFactory,
PerPartitionCursor,
from airbyte_cdk.legacy.sources.declarative.incremental.datetime_based_cursor import (
DatetimeBasedCursor,
)
from airbyte_cdk.sources.declarative.incremental.datetime_based_cursor import DatetimeBasedCursor
from airbyte_cdk.sources.declarative.incremental.declarative_cursor import DeclarativeCursor
from airbyte_cdk.sources.declarative.incremental.global_substream_cursor import (
from airbyte_cdk.legacy.sources.declarative.incremental.declarative_cursor import DeclarativeCursor
from airbyte_cdk.legacy.sources.declarative.incremental.global_substream_cursor import (
GlobalSubstreamCursor,
iterate_with_last_flag_and_state,
)
from airbyte_cdk.legacy.sources.declarative.incremental.per_partition_cursor import (
CursorFactory,
PerPartitionCursor,
)
from airbyte_cdk.sources.declarative.partition_routers.partition_router import PartitionRouter
from airbyte_cdk.sources.types import Record, StreamSlice, StreamState

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from dataclasses import InitVar, dataclass
from typing import Any, Iterable, Mapping, Optional

from airbyte_cdk.sources.declarative.incremental import DeclarativeCursor
from airbyte_cdk.legacy.sources.declarative.incremental import DeclarativeCursor
from airbyte_cdk.sources.declarative.types import Record, StreamSlice, StreamState
from airbyte_cdk.sources.streams.checkpoint.checkpoint_reader import FULL_REFRESH_COMPLETE_STATE

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
from dataclasses import InitVar, dataclass
from typing import Any, List, Mapping, Tuple, Union

from airbyte_cdk.sources.abstract_source import AbstractSource
from airbyte_cdk.sources import Source
from airbyte_cdk.sources.declarative.checks.check_stream import evaluate_availability
from airbyte_cdk.sources.declarative.checks.connection_checker import ConnectionChecker
from airbyte_cdk.sources.streams import Stream
from airbyte_cdk.sources.streams.concurrent.abstract_stream import AbstractStream
from airbyte_cdk.sources.streams.http.availability_strategy import HttpAvailabilityStrategy


@dataclass
Expand All @@ -33,7 +33,10 @@ def __post_init__(self, parameters: Mapping[str, Any]) -> None:
self._parameters = parameters

def check_connection(
self, source: AbstractSource, logger: logging.Logger, config: Mapping[str, Any]
self,
source: Source,
logger: logging.Logger,
config: Mapping[str, Any],
) -> Tuple[bool, Any]:
streams: List[Union[Stream, AbstractStream]] = source.streams(config=config) # type: ignore # this is a migration step and we expect the declarative CDK to migrate off of ConnectionChecker

Expand Down
9 changes: 6 additions & 3 deletions airbyte_cdk/sources/declarative/checks/check_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from dataclasses import InitVar, dataclass
from typing import Any, Dict, List, Mapping, Optional, Tuple, Union

from airbyte_cdk.sources.abstract_source import AbstractSource
from airbyte_cdk.sources import Source
from airbyte_cdk.sources.declarative.checks.connection_checker import ConnectionChecker
from airbyte_cdk.sources.streams.concurrent.abstract_stream import AbstractStream
from airbyte_cdk.sources.streams.core import Stream
Expand Down Expand Up @@ -64,7 +64,10 @@ def _log_error(self, logger: logging.Logger, action: str, error: Exception) -> T
return False, error_message

def check_connection(
self, source: AbstractSource, logger: logging.Logger, config: Mapping[str, Any]
self,
source: Source,
logger: logging.Logger,
config: Mapping[str, Any],
) -> Tuple[bool, Any]:
"""Checks the connection to the source and its streams."""
try:
Expand Down Expand Up @@ -118,7 +121,7 @@ def _check_stream_availability(

def _check_dynamic_streams_availability(
self,
source: AbstractSource,
source: Source,
stream_name_to_stream: Dict[str, Union[Stream, AbstractStream]],
logger: logging.Logger,
) -> Tuple[bool, Any]:
Expand Down
7 changes: 5 additions & 2 deletions airbyte_cdk/sources/declarative/checks/connection_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from abc import ABC, abstractmethod
from typing import Any, Mapping, Tuple

from airbyte_cdk import AbstractSource
from airbyte_cdk.sources import Source


class ConnectionChecker(ABC):
Expand All @@ -16,7 +16,10 @@ class ConnectionChecker(ABC):

@abstractmethod
def check_connection(
self, source: AbstractSource, logger: logging.Logger, config: Mapping[str, Any]
self,
source: Source,
logger: logging.Logger,
config: Mapping[str, Any],
) -> Tuple[bool, Any]:
"""
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
Expand Down
Loading
Loading