1
0
mirror of synced 2026-01-18 15:02:51 -05:00
Files
airbyte/airbyte-connector-builder-server/connector_builder/impl/adapter.py
Maxime Carbonneau-Leclerc ca8cdc40aa [ISSUE #20771] limiting the number of requests performed to the backe… (#21525)
* [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
2023-01-24 15:19:19 +00:00

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