airbyte.strategies

Read and write strategies for PyAirbyte.

 1# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
 2
 3"""Read and write strategies for PyAirbyte."""
 4from __future__ import annotations
 5
 6from enum import Enum
 7
 8
 9class WriteStrategy(str, Enum):
10    """Read strategies for PyAirbyte."""
11
12    MERGE = "merge"
13    """Merge new records with existing records.
14
15    This requires a primary key to be set on the stream.
16    If no primary key is set, this will raise an exception.
17
18    To apply this strategy in cases where some destination streams don't have a primary key,
19    please use the `auto` strategy instead.
20    """
21
22    APPEND = "append"
23    """Append new records to existing records."""
24
25    REPLACE = "replace"
26    """Replace existing records with new records."""
27
28    AUTO = "auto"
29    """Automatically determine the best strategy to use.
30
31    This will use the following logic:
32    - If there's a primary key, use merge.
33    - Else, if there's an incremental key, use append.
34    - Else, use full replace (table swap).
35    """
class WriteStrategy(builtins.str, enum.Enum):
10class WriteStrategy(str, Enum):
11    """Read strategies for PyAirbyte."""
12
13    MERGE = "merge"
14    """Merge new records with existing records.
15
16    This requires a primary key to be set on the stream.
17    If no primary key is set, this will raise an exception.
18
19    To apply this strategy in cases where some destination streams don't have a primary key,
20    please use the `auto` strategy instead.
21    """
22
23    APPEND = "append"
24    """Append new records to existing records."""
25
26    REPLACE = "replace"
27    """Replace existing records with new records."""
28
29    AUTO = "auto"
30    """Automatically determine the best strategy to use.
31
32    This will use the following logic:
33    - If there's a primary key, use merge.
34    - Else, if there's an incremental key, use append.
35    - Else, use full replace (table swap).
36    """

Read strategies for PyAirbyte.

MERGE = <WriteStrategy.MERGE: 'merge'>

Merge new records with existing records.

This requires a primary key to be set on the stream. If no primary key is set, this will raise an exception.

To apply this strategy in cases where some destination streams don't have a primary key, please use the auto strategy instead.

APPEND = <WriteStrategy.APPEND: 'append'>

Append new records to existing records.

REPLACE = <WriteStrategy.REPLACE: 'replace'>

Replace existing records with new records.

AUTO = <WriteStrategy.AUTO: 'auto'>

Automatically determine the best strategy to use.

This will use the following logic:

  • If there's a primary key, use merge.
  • Else, if there's an incremental key, use append.
  • Else, use full replace (table swap).
Inherited Members
enum.Enum
name
value
builtins.str
encode
replace
split
rsplit
join
capitalize
casefold
title
center
count
expandtabs
find
partition
index
ljust
lower
lstrip
rfind
rindex
rjust
rstrip
rpartition
splitlines
strip
swapcase
translate
upper
startswith
endswith
removeprefix
removesuffix
isascii
islower
isupper
istitle
isspace
isdecimal
isdigit
isnumeric
isalpha
isalnum
isidentifier
isprintable
zfill
format
format_map
maketrans