1
0
mirror of synced 2025-12-31 06:05:12 -05:00
Files
airbyte/airbyte-cdk/python/airbyte_cdk/sources/streams/availability_strategy.py
Cole Snodgrass 2e099acc52 update headers from 2022 -> 2023 (#22594)
* It's 2023!

* 2022 -> 2023

---------

Co-authored-by: evantahler <evan@airbyte.io>
2023-02-08 13:01:16 -08:00

34 lines
1007 B
Python

#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
import logging
import typing
from abc import ABC, abstractmethod
from typing import Optional, Tuple
from airbyte_cdk.sources.streams import Stream
if typing.TYPE_CHECKING:
from airbyte_cdk.sources import Source
class AvailabilityStrategy(ABC):
"""
Abstract base class for checking stream availability.
"""
@abstractmethod
def check_availability(self, stream: Stream, logger: logging.Logger, source: Optional["Source"]) -> Tuple[bool, Optional[str]]:
"""
Checks stream availability.
:param stream: stream
:param logger: source logger
:param source: (optional) source
:return: A tuple of (boolean, str). If boolean is true, then the stream
is available, and no str is required. Otherwise, the stream is unavailable
for some reason and the str should describe what went wrong and how to
resolve the unavailability, if possible.
"""