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.sources.concurrent_source.partition_generation_completed_sentinel import (
 8    PartitionGenerationCompletedSentinel,
 9)
10from airbyte_cdk.sources.streams.concurrent.partitions.partition import Partition
11from airbyte_cdk.sources.types import Record
12
13
14class PartitionCompleteSentinel:
15    """
16    A sentinel object indicating all records for a partition were produced.
17    Includes a pointer to the partition that was processed.
18    """
19
20    def __init__(self, partition: Partition, is_successful: bool = True):
21        """
22        :param partition: The partition that was processed
23        """
24        self.partition = partition
25        self.is_successful = is_successful
26
27    def __eq__(self, other: Any) -> bool:
28        if isinstance(other, PartitionCompleteSentinel):
29            return self.partition == other.partition
30        return False
31
32
33"""
34Typedef representing the items that can be added to the ThreadBasedConcurrentStream
35"""
36QueueItem = Union[
37    Record, Partition, PartitionCompleteSentinel, PartitionGenerationCompletedSentinel, Exception
38]
class PartitionCompleteSentinel:
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

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)
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
Parameters
  • partition: The partition that was processed
partition
is_successful