* [ISSUE #20771] limiting the number of requests performed to the backend without flag * [ISSUE #20771] code reviewing my own code * [ISSUE #20771] adding ABC to paginator * [ISSUE #20771] format code * [ISSUE #20771] adding slices to connector builder read request (#21605) * [ISSUE #20771] adding slices to connector builder read request * [ISSUE #20771] formatting * [ISSUE #20771] set flag when limit requests reached (#21619) * [ISSUE #20771] set flag when limit requests reached * [ISSUE #20771] assert proper value on test read objects __init__ * [ISSUE #20771] code review and fix edge case * [ISSUE #20771] fix flake8 error * [ISSUE #20771] code review * 🤖 Bump minor version of Airbyte CDK * to run the CI
43 lines
1.2 KiB
Python
43 lines
1.2 KiB
Python
#
|
|
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
|
|
#
|
|
|
|
from abc import ABC, abstractmethod
|
|
from typing import Any, Dict, Iterator, List
|
|
|
|
from airbyte_cdk.models import AirbyteMessage
|
|
from airbyte_cdk.sources.streams.http import HttpStream
|
|
|
|
|
|
class CdkAdapter(ABC):
|
|
"""
|
|
Abstract base class for the connector builder's CDK adapter.
|
|
"""
|
|
|
|
@abstractmethod
|
|
def get_http_streams(self, config: Dict[str, Any]) -> List[HttpStream]:
|
|
"""
|
|
Gets a list of HTTP streams.
|
|
|
|
:param config: The user-provided configuration as specified by the source's spec.
|
|
:return: A list of `HttpStream`s.
|
|
"""
|
|
|
|
@abstractmethod
|
|
def read_stream(self, stream: str, config: Dict[str, Any]) -> Iterator[AirbyteMessage]:
|
|
"""
|
|
Reads data from the specified stream.
|
|
|
|
:param stream: stream
|
|
:param config: The user-provided configuration as specified by the source's spec.
|
|
:return: An iterator over `AirbyteMessage` objects.
|
|
"""
|
|
|
|
|
|
class CdkAdapterFactory(ABC):
|
|
|
|
@abstractmethod
|
|
def create(self, manifest: Dict[str, Any]) -> CdkAdapter:
|
|
"""Return an implementation of CdkAdapter"""
|
|
pass
|