airbyte_cdk.sources.streams.concurrent.partitions.types

 1#
 2# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
 3#
 4
 5from typing import Any, Union
 6
 7from airbyte_cdk.models import AirbyteMessage
 8from airbyte_cdk.sources.concurrent_source.partition_generation_completed_sentinel import (
 9    PartitionGenerationCompletedSentinel,
10)
11from airbyte_cdk.sources.streams.concurrent.partitions.partition import Partition
12from airbyte_cdk.sources.types import Record
13
14
15class PartitionCompleteSentinel:
16    """
17    A sentinel object indicating all records for a partition were produced.
18    Includes a pointer to the partition that was processed.
19    """
20
21    def __init__(self, partition: Partition, is_successful: bool = True):
22        """
23        :param partition: The partition that was processed
24        """
25        self.partition = partition
26        self.is_successful = is_successful
27
28    def __eq__(self, other: Any) -> bool:
29        if isinstance(other, PartitionCompleteSentinel):
30            return self.partition == other.partition
31        return False
32
33
34"""
35Typedef representing the items that can be added to the ThreadBasedConcurrentStream
36"""
37QueueItem = Union[
38    Record,
39    Partition,
40    PartitionCompleteSentinel,
41    PartitionGenerationCompletedSentinel,
42    Exception,
43    AirbyteMessage,
44]
class PartitionCompleteSentinel:
16class PartitionCompleteSentinel:
17    """
18    A sentinel object indicating all records for a partition were produced.
19    Includes a pointer to the partition that was processed.
20    """
21
22    def __init__(self, partition: Partition, is_successful: bool = True):
23        """
24        :param partition: The partition that was processed
25        """
26        self.partition = partition
27        self.is_successful = is_successful
28
29    def __eq__(self, other: Any) -> bool:
30        if isinstance(other, PartitionCompleteSentinel):
31            return self.partition == other.partition
32        return False

A sentinel object indicating all records for a partition were produced. Includes a pointer to the partition that was processed.

PartitionCompleteSentinel( partition: airbyte_cdk.sources.streams.concurrent.partitions.partition.Partition, is_successful: bool = True)
22    def __init__(self, partition: Partition, is_successful: bool = True):
23        """
24        :param partition: The partition that was processed
25        """
26        self.partition = partition
27        self.is_successful = is_successful
Parameters
  • partition: The partition that was processed
partition
is_successful