airbyte-cdk 6.37.2.dev1__py3-none-any.whl → 6.38.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- airbyte_cdk/sources/declarative/concurrent_declarative_source.py +28 -7
- airbyte_cdk/sources/declarative/datetime/__init__.py +0 -4
- airbyte_cdk/sources/declarative/datetime/datetime_parser.py +11 -1
- airbyte_cdk/sources/declarative/declarative_component_schema.yaml +72 -5
- airbyte_cdk/sources/declarative/decoders/composite_raw_decoder.py +2 -3
- airbyte_cdk/sources/declarative/interpolation/macros.py +3 -3
- airbyte_cdk/sources/declarative/models/declarative_component_schema.py +34 -8
- airbyte_cdk/sources/declarative/parsers/custom_code_compiler.py +18 -4
- airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py +120 -8
- airbyte_cdk/sources/declarative/requesters/README.md +5 -5
- airbyte_cdk/sources/declarative/requesters/http_job_repository.py +18 -13
- airbyte_cdk/sources/declarative/requesters/http_requester.py +49 -17
- airbyte_cdk/sources/declarative/requesters/paginators/default_paginator.py +25 -4
- airbyte_cdk/sources/declarative/requesters/paginators/no_pagination.py +6 -1
- airbyte_cdk/sources/declarative/requesters/paginators/paginator.py +7 -2
- airbyte_cdk/sources/declarative/requesters/requester.py +7 -1
- airbyte_cdk/sources/declarative/retrievers/simple_retriever.py +21 -4
- airbyte_cdk/sources/declarative/transformations/keys_to_snake_transformation.py +2 -2
- airbyte_cdk/sources/declarative/yaml_declarative_source.py +0 -1
- airbyte_cdk/sources/streams/concurrent/state_converters/abstract_stream_state_converter.py +2 -1
- airbyte_cdk/sources/streams/concurrent/state_converters/incrementing_count_stream_state_converter.py +92 -0
- airbyte_cdk/sources/streams/http/error_handlers/default_error_mapping.py +3 -3
- airbyte_cdk/sources/types.py +1 -0
- airbyte_cdk/utils/mapping_helpers.py +18 -1
- {airbyte_cdk-6.37.2.dev1.dist-info → airbyte_cdk-6.38.0.dist-info}/METADATA +4 -4
- {airbyte_cdk-6.37.2.dev1.dist-info → airbyte_cdk-6.38.0.dist-info}/RECORD +30 -34
- airbyte_cdk/sources/embedded/__init__.py +0 -3
- airbyte_cdk/sources/embedded/base_integration.py +0 -61
- airbyte_cdk/sources/embedded/catalog.py +0 -57
- airbyte_cdk/sources/embedded/runner.py +0 -57
- airbyte_cdk/sources/embedded/tools.py +0 -27
- {airbyte_cdk-6.37.2.dev1.dist-info → airbyte_cdk-6.38.0.dist-info}/LICENSE.txt +0 -0
- {airbyte_cdk-6.37.2.dev1.dist-info → airbyte_cdk-6.38.0.dist-info}/LICENSE_SHORT +0 -0
- {airbyte_cdk-6.37.2.dev1.dist-info → airbyte_cdk-6.38.0.dist-info}/WHEEL +0 -0
- {airbyte_cdk-6.37.2.dev1.dist-info → airbyte_cdk-6.38.0.dist-info}/entry_points.txt +0 -0
airbyte_cdk/sources/streams/concurrent/state_converters/incrementing_count_stream_state_converter.py
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
|
3
|
+
#
|
4
|
+
|
5
|
+
from typing import Any, Callable, MutableMapping, Optional, Tuple
|
6
|
+
|
7
|
+
from airbyte_cdk.sources.streams.concurrent.cursor import CursorField
|
8
|
+
from airbyte_cdk.sources.streams.concurrent.state_converters.abstract_stream_state_converter import (
|
9
|
+
AbstractStreamStateConverter,
|
10
|
+
ConcurrencyCompatibleStateType,
|
11
|
+
)
|
12
|
+
|
13
|
+
|
14
|
+
class IncrementingCountStreamStateConverter(AbstractStreamStateConverter):
|
15
|
+
def _from_state_message(self, value: Any) -> Any:
|
16
|
+
return value
|
17
|
+
|
18
|
+
def _to_state_message(self, value: Any) -> Any:
|
19
|
+
return value
|
20
|
+
|
21
|
+
@classmethod
|
22
|
+
def get_end_provider(cls) -> Callable[[], float]:
|
23
|
+
return lambda: float("inf")
|
24
|
+
|
25
|
+
def convert_from_sequential_state(
|
26
|
+
self,
|
27
|
+
cursor_field: "CursorField", # to deprecate as it is only needed for sequential state
|
28
|
+
stream_state: MutableMapping[str, Any],
|
29
|
+
start: Optional[Any],
|
30
|
+
) -> Tuple[Any, MutableMapping[str, Any]]:
|
31
|
+
"""
|
32
|
+
Convert the state message to the format required by the ConcurrentCursor.
|
33
|
+
|
34
|
+
e.g.
|
35
|
+
{
|
36
|
+
"state_type": ConcurrencyCompatibleStateType.date_range.value,
|
37
|
+
"metadata": { … },
|
38
|
+
"slices": [
|
39
|
+
{"start": "10", "end": "2021-01-18T21:18:20.000+00:00"},
|
40
|
+
]
|
41
|
+
}
|
42
|
+
"""
|
43
|
+
sync_start = self._get_sync_start(cursor_field, stream_state, start)
|
44
|
+
if self.is_state_message_compatible(stream_state):
|
45
|
+
return sync_start, stream_state
|
46
|
+
|
47
|
+
# Create a slice to represent the records synced during prior syncs.
|
48
|
+
# The start and end are the same to avoid confusion as to whether the records for this slice
|
49
|
+
# were actually synced
|
50
|
+
slices = [
|
51
|
+
{
|
52
|
+
self.START_KEY: start if start is not None else sync_start,
|
53
|
+
self.END_KEY: sync_start, # this may not be relevant anymore
|
54
|
+
self.MOST_RECENT_RECORD_KEY: sync_start,
|
55
|
+
}
|
56
|
+
]
|
57
|
+
|
58
|
+
return sync_start, {
|
59
|
+
"state_type": ConcurrencyCompatibleStateType.integer.value,
|
60
|
+
"slices": slices,
|
61
|
+
"legacy": stream_state,
|
62
|
+
}
|
63
|
+
|
64
|
+
def parse_value(self, value: int) -> int:
|
65
|
+
return value
|
66
|
+
|
67
|
+
@property
|
68
|
+
def zero_value(self) -> int:
|
69
|
+
return 0
|
70
|
+
|
71
|
+
def increment(self, value: int) -> int:
|
72
|
+
return value + 1
|
73
|
+
|
74
|
+
def output_format(self, value: int) -> int:
|
75
|
+
return value
|
76
|
+
|
77
|
+
def _get_sync_start(
|
78
|
+
self,
|
79
|
+
cursor_field: CursorField,
|
80
|
+
stream_state: MutableMapping[str, Any],
|
81
|
+
start: Optional[int],
|
82
|
+
) -> int:
|
83
|
+
sync_start = start if start is not None else self.zero_value
|
84
|
+
prev_sync_low_water_mark: Optional[int] = (
|
85
|
+
stream_state[cursor_field.cursor_field_key]
|
86
|
+
if cursor_field.cursor_field_key in stream_state
|
87
|
+
else None
|
88
|
+
)
|
89
|
+
if prev_sync_low_water_mark and prev_sync_low_water_mark >= sync_start:
|
90
|
+
return prev_sync_low_water_mark
|
91
|
+
else:
|
92
|
+
return sync_start
|
@@ -19,9 +19,9 @@ DEFAULT_ERROR_MAPPING: Mapping[Union[int, str, Type[Exception]], ErrorResolution
|
|
19
19
|
error_message="Invalid Protocol Schema: The endpoint that data is being requested from is using an invalid or insecure. Exception: requests.exceptions.InvalidSchema",
|
20
20
|
),
|
21
21
|
InvalidURL: ErrorResolution(
|
22
|
-
response_action=ResponseAction.
|
23
|
-
failure_type=FailureType.
|
24
|
-
error_message="Invalid URL specified: The endpoint that data is being requested from is not a valid URL. Exception: requests.exceptions.InvalidURL",
|
22
|
+
response_action=ResponseAction.RETRY,
|
23
|
+
failure_type=FailureType.transient_error,
|
24
|
+
error_message="Invalid URL specified or DNS error occurred: The endpoint that data is being requested from is not a valid URL. Exception: requests.exceptions.InvalidURL",
|
25
25
|
),
|
26
26
|
RequestException: ErrorResolution(
|
27
27
|
response_action=ResponseAction.RETRY,
|
airbyte_cdk/sources/types.py
CHANGED
@@ -10,7 +10,7 @@ from airbyte_cdk.sources.declarative.requesters.request_option import (
|
|
10
10
|
RequestOption,
|
11
11
|
RequestOptionType,
|
12
12
|
)
|
13
|
-
from airbyte_cdk.sources.types import Config
|
13
|
+
from airbyte_cdk.sources.types import Config, StreamSlice, StreamState
|
14
14
|
|
15
15
|
|
16
16
|
def _merge_mappings(
|
@@ -143,3 +143,20 @@ def _validate_component_request_option_paths(
|
|
143
143
|
)
|
144
144
|
except ValueError as error:
|
145
145
|
raise ValueError(error)
|
146
|
+
|
147
|
+
|
148
|
+
def get_interpolation_context(
|
149
|
+
stream_state: Optional[StreamState] = None,
|
150
|
+
stream_slice: Optional[StreamSlice] = None,
|
151
|
+
next_page_token: Optional[Mapping[str, Any]] = None,
|
152
|
+
) -> Mapping[str, Any]:
|
153
|
+
return {
|
154
|
+
"stream_slice": stream_slice,
|
155
|
+
"next_page_token": next_page_token,
|
156
|
+
# update the context with extra fields, if passed.
|
157
|
+
**(
|
158
|
+
stream_slice.extra_fields
|
159
|
+
if stream_slice is not None and hasattr(stream_slice, "extra_fields")
|
160
|
+
else {}
|
161
|
+
),
|
162
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: airbyte-cdk
|
3
|
-
Version: 6.
|
3
|
+
Version: 6.38.0
|
4
4
|
Summary: A framework for writing Airbyte Connectors.
|
5
5
|
Home-page: https://airbyte.com
|
6
6
|
License: MIT
|
@@ -22,13 +22,13 @@ Provides-Extra: sql
|
|
22
22
|
Provides-Extra: vector-db-based
|
23
23
|
Requires-Dist: Jinja2 (>=3.1.2,<3.2.0)
|
24
24
|
Requires-Dist: PyYAML (>=6.0.1,<7.0.0)
|
25
|
-
Requires-Dist: Unidecode (>=1.3,<2.0)
|
26
25
|
Requires-Dist: airbyte-protocol-models-dataclasses (>=0.14,<0.15)
|
26
|
+
Requires-Dist: anyascii (>=0.3.2,<0.4.0)
|
27
27
|
Requires-Dist: avro (>=1.11.2,<1.13.0) ; extra == "file-based"
|
28
28
|
Requires-Dist: backoff
|
29
29
|
Requires-Dist: cachetools
|
30
30
|
Requires-Dist: cohere (==4.21) ; extra == "vector-db-based"
|
31
|
-
Requires-Dist: cryptography (>=
|
31
|
+
Requires-Dist: cryptography (>=44.0.0,<45.0.0)
|
32
32
|
Requires-Dist: dpath (>=2.1.6,<3.0.0)
|
33
33
|
Requires-Dist: dunamai (>=1.22.0,<2.0.0)
|
34
34
|
Requires-Dist: fastavro (>=1.8.0,<1.9.0) ; extra == "file-based"
|
@@ -47,7 +47,7 @@ Requires-Dist: pandas (==2.2.2)
|
|
47
47
|
Requires-Dist: pdf2image (==1.16.3) ; extra == "file-based"
|
48
48
|
Requires-Dist: pdfminer.six (==20221105) ; extra == "file-based"
|
49
49
|
Requires-Dist: psutil (==6.1.0)
|
50
|
-
Requires-Dist: pyarrow (>=
|
50
|
+
Requires-Dist: pyarrow (>=19.0.0,<20.0.0) ; extra == "file-based"
|
51
51
|
Requires-Dist: pydantic (>=2.7,<3.0)
|
52
52
|
Requires-Dist: pyjwt (>=2.8.0,<3.0.0)
|
53
53
|
Requires-Dist: pyrate-limiter (>=3.1.0,<3.2.0)
|
@@ -67,15 +67,15 @@ airbyte_cdk/sources/declarative/checks/check_stream.py,sha256=dAA-UhmMj0WLXCkRQr
|
|
67
67
|
airbyte_cdk/sources/declarative/checks/connection_checker.py,sha256=MBRJo6WJlZQHpIfOGaNOkkHUmgUl_4wDM6VPo41z5Ss,1383
|
68
68
|
airbyte_cdk/sources/declarative/concurrency_level/__init__.py,sha256=5XUqrmlstYlMM0j6crktlKQwALek0uiz2D3WdM46MyA,191
|
69
69
|
airbyte_cdk/sources/declarative/concurrency_level/concurrency_level.py,sha256=YIwCTCpOr_QSNW4ltQK0yUGWInI8PKNY216HOOegYLk,2101
|
70
|
-
airbyte_cdk/sources/declarative/concurrent_declarative_source.py,sha256=
|
71
|
-
airbyte_cdk/sources/declarative/datetime/__init__.py,sha256=
|
72
|
-
airbyte_cdk/sources/declarative/datetime/datetime_parser.py,sha256=
|
70
|
+
airbyte_cdk/sources/declarative/concurrent_declarative_source.py,sha256=rAp-sgld4n8Tmybz-51m7VcYXqKwzKDpCJVr1elmkRc,26824
|
71
|
+
airbyte_cdk/sources/declarative/datetime/__init__.py,sha256=4Hw-PX1-VgESLF16cDdvuYCzGJtHntThLF4qIiULWeo,61
|
72
|
+
airbyte_cdk/sources/declarative/datetime/datetime_parser.py,sha256=_zGNGq31RNy_0QBLt_EcTvgPyhj7urPdx6oA3M5-r3o,3150
|
73
73
|
airbyte_cdk/sources/declarative/datetime/min_max_datetime.py,sha256=0BHBtDNQZfvwM45-tY5pNlTcKAFSGGNxemoi0Jic-0E,5785
|
74
|
-
airbyte_cdk/sources/declarative/declarative_component_schema.yaml,sha256=
|
74
|
+
airbyte_cdk/sources/declarative/declarative_component_schema.yaml,sha256=n8hJVquDj00_VS_I0B2QgwYNcNcfsVZdkajAKArcOHU,147487
|
75
75
|
airbyte_cdk/sources/declarative/declarative_source.py,sha256=nF7wBqFd3AQmEKAm4CnIo29CJoQL562cJGSCeL8U8bA,1531
|
76
76
|
airbyte_cdk/sources/declarative/declarative_stream.py,sha256=venZjfpvtqr3oFSuvMBWtn4h9ayLhD4L65ACuXCDZ64,10445
|
77
77
|
airbyte_cdk/sources/declarative/decoders/__init__.py,sha256=JHb_0d3SE6kNY10mxA5YBEKPeSbsWYjByq1gUQxepoE,953
|
78
|
-
airbyte_cdk/sources/declarative/decoders/composite_raw_decoder.py,sha256=
|
78
|
+
airbyte_cdk/sources/declarative/decoders/composite_raw_decoder.py,sha256=DJbWaaJ5LHCBpyWz-4bEw8rqtJYqabEYZtxnfRtWFE0,4946
|
79
79
|
airbyte_cdk/sources/declarative/decoders/decoder.py,sha256=sl-Gt8lXi7yD2Q-sD8je5QS2PbgrgsYjxRLWsay7DMc,826
|
80
80
|
airbyte_cdk/sources/declarative/decoders/json_decoder.py,sha256=BdWpXXPhEGf_zknggJmhojLosmxuw51RBVTS0jvdCPc,2080
|
81
81
|
airbyte_cdk/sources/declarative/decoders/noop_decoder.py,sha256=iZh0yKY_JzgBnJWiubEusf5c0o6Khd-8EWFWT-8EgFo,542
|
@@ -107,19 +107,19 @@ airbyte_cdk/sources/declarative/interpolation/interpolated_nested_mapping.py,sha
|
|
107
107
|
airbyte_cdk/sources/declarative/interpolation/interpolated_string.py,sha256=CQkHqGlfa87G6VYMtBAQWin7ECKpfMdrDcg0JO5_rhc,3212
|
108
108
|
airbyte_cdk/sources/declarative/interpolation/interpolation.py,sha256=9IoeuWam3L6GyN10L6U8xNWXmkt9cnahSDNkez1OmFY,982
|
109
109
|
airbyte_cdk/sources/declarative/interpolation/jinja.py,sha256=UQeuS4Vpyp4hlOn-R3tRyeBX0e9IoV6jQ6gH-Jz8lY0,7182
|
110
|
-
airbyte_cdk/sources/declarative/interpolation/macros.py,sha256=
|
110
|
+
airbyte_cdk/sources/declarative/interpolation/macros.py,sha256=HQKHKnjE17zKoPn27ZpTpugRZZQSaof4GVzUUZaV2eE,5081
|
111
111
|
airbyte_cdk/sources/declarative/manifest_declarative_source.py,sha256=TN6GCgLXaWDONTaJwQ3A5ELqC-sxwKz-UYSraJYB-dI,17078
|
112
112
|
airbyte_cdk/sources/declarative/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
113
113
|
airbyte_cdk/sources/declarative/migrations/legacy_to_per_partition_state_migration.py,sha256=iemy3fKLczcU0-Aor7tx5jcT6DRedKMqyK7kCOp01hg,3924
|
114
114
|
airbyte_cdk/sources/declarative/migrations/state_migration.py,sha256=KWPjealMLKSMtajXgkdGgKg7EmTLR-CqqD7UIh0-eDU,794
|
115
115
|
airbyte_cdk/sources/declarative/models/__init__.py,sha256=nUFxNCiKeYRVXuZEKA7GD-lTHxsiKcQ8FitZjKhPIvE,100
|
116
|
-
airbyte_cdk/sources/declarative/models/declarative_component_schema.py,sha256=
|
116
|
+
airbyte_cdk/sources/declarative/models/declarative_component_schema.py,sha256=DfbPi512ovaBSWDICJfjIkC3pXDn2aNr1BP-eiLOLyA,103556
|
117
117
|
airbyte_cdk/sources/declarative/parsers/__init__.py,sha256=ZnqYNxHsKCgO38IwB34RQyRMXTs4GTvlRi3ImKnIioo,61
|
118
|
-
airbyte_cdk/sources/declarative/parsers/custom_code_compiler.py,sha256=
|
118
|
+
airbyte_cdk/sources/declarative/parsers/custom_code_compiler.py,sha256=jDw_TttD3_hpfevXOH-0Ws0eRuqt6wvED0BqosGPRjI,5938
|
119
119
|
airbyte_cdk/sources/declarative/parsers/custom_exceptions.py,sha256=Rir9_z3Kcd5Es0-LChrzk-0qubAsiK_RSEnLmK2OXm8,553
|
120
120
|
airbyte_cdk/sources/declarative/parsers/manifest_component_transformer.py,sha256=CXwTfD3wSQq3okcqwigpprbHhSURUokh4GK2OmOyKC8,9132
|
121
121
|
airbyte_cdk/sources/declarative/parsers/manifest_reference_resolver.py,sha256=IWUOdF03o-aQn0Occo1BJCxU0Pz-QILk5L67nzw2thw,6803
|
122
|
-
airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=
|
122
|
+
airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=Tq-T4iFS8Dh8cGEEN0KrowF_QqPxiXvcs-Djct1qlpA,140636
|
123
123
|
airbyte_cdk/sources/declarative/partition_routers/__init__.py,sha256=HJ-Syp3p7RpyR_OK0X_a2kSyISfu3W-PKrRI16iY0a8,957
|
124
124
|
airbyte_cdk/sources/declarative/partition_routers/async_job_partition_router.py,sha256=VelO7zKqKtzMJ35jyFeg0ypJLQC0plqqIBNXoBW1G2E,3001
|
125
125
|
airbyte_cdk/sources/declarative/partition_routers/cartesian_product_stream_slicer.py,sha256=c5cuVFM6NFkuQqG8Z5IwkBuwDrvXZN1CunUOM_L0ezg,6892
|
@@ -127,7 +127,7 @@ airbyte_cdk/sources/declarative/partition_routers/list_partition_router.py,sha25
|
|
127
127
|
airbyte_cdk/sources/declarative/partition_routers/partition_router.py,sha256=YyEIzdmLd1FjbVP3QbQ2VFCLW_P-OGbVh6VpZShp54k,2218
|
128
128
|
airbyte_cdk/sources/declarative/partition_routers/single_partition_router.py,sha256=SKzKjSyfccq4dxGIh-J6ejrgkCHzaiTIazmbmeQiRD4,1942
|
129
129
|
airbyte_cdk/sources/declarative/partition_routers/substream_partition_router.py,sha256=LlWj-Ofs-xfjlqmDzH8OYpyblP2Pb8bPDdR9g1UZyt0,17693
|
130
|
-
airbyte_cdk/sources/declarative/requesters/README.md,sha256=
|
130
|
+
airbyte_cdk/sources/declarative/requesters/README.md,sha256=DQll2qsIzzTiiP35kJp16ONpr7cFeUQNgPfhl5krB24,2675
|
131
131
|
airbyte_cdk/sources/declarative/requesters/__init__.py,sha256=d7a3OoHbqaJDyyPli3nqqJ2yAW_SLX6XDaBAKOwvpxw,364
|
132
132
|
airbyte_cdk/sources/declarative/requesters/error_handlers/__init__.py,sha256=SkEDcJxlT1683rNx93K9whoS0OyUukkuOfToGtgpF58,776
|
133
133
|
airbyte_cdk/sources/declarative/requesters/error_handlers/backoff_strategies/__init__.py,sha256=1WZdpFmWL6W_Dko0qjflTaKIWeqt8jHT-D6HcujIp3s,884
|
@@ -142,12 +142,12 @@ airbyte_cdk/sources/declarative/requesters/error_handlers/default_error_handler.
|
|
142
142
|
airbyte_cdk/sources/declarative/requesters/error_handlers/default_http_response_filter.py,sha256=q0YkeYUUWO6iErUy0vjqiOkhg8_9d5YcCmtlpXAJJ9E,1314
|
143
143
|
airbyte_cdk/sources/declarative/requesters/error_handlers/error_handler.py,sha256=Tan66odx8VHzfdyyXMQkXz2pJYksllGqvxmpoajgcK4,669
|
144
144
|
airbyte_cdk/sources/declarative/requesters/error_handlers/http_response_filter.py,sha256=E-fQbt4ShfxZVoqfnmOx69C6FUPWZz8BIqI3DN9Kcjs,7935
|
145
|
-
airbyte_cdk/sources/declarative/requesters/http_job_repository.py,sha256=
|
146
|
-
airbyte_cdk/sources/declarative/requesters/http_requester.py,sha256=
|
145
|
+
airbyte_cdk/sources/declarative/requesters/http_job_repository.py,sha256=4wpP0ZNTMLugi-Rc1OFdFaxWfRZSl45nzhHqMFCE8SQ,11924
|
146
|
+
airbyte_cdk/sources/declarative/requesters/http_requester.py,sha256=KS2nEUKMnyow8HvvfJJbWdPjlglIWSOZIAxrwkmXCI4,16356
|
147
147
|
airbyte_cdk/sources/declarative/requesters/paginators/__init__.py,sha256=uArbKs9JKNCt7t9tZoeWwjDpyI1HoPp29FNW0JzvaEM,644
|
148
|
-
airbyte_cdk/sources/declarative/requesters/paginators/default_paginator.py,sha256=
|
149
|
-
airbyte_cdk/sources/declarative/requesters/paginators/no_pagination.py,sha256=
|
150
|
-
airbyte_cdk/sources/declarative/requesters/paginators/paginator.py,sha256=
|
148
|
+
airbyte_cdk/sources/declarative/requesters/paginators/default_paginator.py,sha256=SB-Af3CRb4mJwhm4EKNxzl_PK2w5QS4tqrSNNMO2IV4,12760
|
149
|
+
airbyte_cdk/sources/declarative/requesters/paginators/no_pagination.py,sha256=b1-zKxYOUMHn7ahdWpzKEzfG4A7s_WQWy-vzRqZWzME,2152
|
150
|
+
airbyte_cdk/sources/declarative/requesters/paginators/paginator.py,sha256=TzJF1Q-CFlsHF9lMSfmnGCxRYm9_UQCmBcHYQpc7F30,2376
|
151
151
|
airbyte_cdk/sources/declarative/requesters/paginators/strategies/__init__.py,sha256=2gly8fuZpDNwtu1Qg6oE2jBLGqQRdzSLJdnpk_iDV6I,767
|
152
152
|
airbyte_cdk/sources/declarative/requesters/paginators/strategies/cursor_pagination_strategy.py,sha256=yLzzK5YIRTkXd2Z-BS__AZXuTd6HXjJIxq05K-lQoxI,3898
|
153
153
|
airbyte_cdk/sources/declarative/requesters/paginators/strategies/offset_increment.py,sha256=WvGt_DTFcAgTR-NHrlrR7B71yG-L6jmfW-Gwm9iYzjY,3624
|
@@ -163,7 +163,7 @@ airbyte_cdk/sources/declarative/requesters/request_options/interpolated_request_
|
|
163
163
|
airbyte_cdk/sources/declarative/requesters/request_options/interpolated_request_options_provider.py,sha256=vOsdHfWHiTFc89WENHPv1hcxLgdzycMXVT_IEtLuhfs,5012
|
164
164
|
airbyte_cdk/sources/declarative/requesters/request_options/request_options_provider.py,sha256=8YRiDzjYvqJ-aMmKFcjqzv_-e8OZ5QG_TbpZ-nuCu6s,2590
|
165
165
|
airbyte_cdk/sources/declarative/requesters/request_path.py,sha256=S3MeFvcaQrMbOkSY2W2VbXLNomqt_3eXqVd9ZhgNwUs,299
|
166
|
-
airbyte_cdk/sources/declarative/requesters/requester.py,sha256=
|
166
|
+
airbyte_cdk/sources/declarative/requesters/requester.py,sha256=OcDzuCBgD1owK_lBPG0KbRRHRn9kzbuRveU4HejDiv4,5116
|
167
167
|
airbyte_cdk/sources/declarative/resolvers/__init__.py,sha256=NiDcz5qi8HPsfX94MUmnX0Rgs_kQXGvucOmJjNWlxKQ,1207
|
168
168
|
airbyte_cdk/sources/declarative/resolvers/components_resolver.py,sha256=KPjKc0yb9artL4ZkeqN8RmEykHH6FJgqXD7fCEnh1X0,1936
|
169
169
|
airbyte_cdk/sources/declarative/resolvers/config_components_resolver.py,sha256=dz4iJV9liD_LzY_Mn4XmAStoUll60R3MIGWV4aN3pgg,5223
|
@@ -171,7 +171,7 @@ airbyte_cdk/sources/declarative/resolvers/http_components_resolver.py,sha256=Aio
|
|
171
171
|
airbyte_cdk/sources/declarative/retrievers/__init__.py,sha256=ix9m1dkR69DcXCXUKC5RK_ZZM7ojTLBQ4IkWQTfmfCk,456
|
172
172
|
airbyte_cdk/sources/declarative/retrievers/async_retriever.py,sha256=dwYZ70eg9DKHEqZydHhMFPkEILbNcXu7E-djOCikNgI,3530
|
173
173
|
airbyte_cdk/sources/declarative/retrievers/retriever.py,sha256=XPLs593Xv8c5cKMc37XzUAYmzlXd1a7eSsspM-CMuWA,1696
|
174
|
-
airbyte_cdk/sources/declarative/retrievers/simple_retriever.py,sha256=
|
174
|
+
airbyte_cdk/sources/declarative/retrievers/simple_retriever.py,sha256=fDhc6dMx75UImh1_TfLm4Le59tsHpqIUZnau7uIJyYw,25043
|
175
175
|
airbyte_cdk/sources/declarative/schema/__init__.py,sha256=xU45UvM5O4c1PSM13UHpCdh5hpW3HXy9vRRGEiAC1rg,795
|
176
176
|
airbyte_cdk/sources/declarative/schema/default_schema_loader.py,sha256=KTACrIE23a83wsm3Rd9Eb4K6-20lrGqYxTHNp9yxsso,1820
|
177
177
|
airbyte_cdk/sources/declarative/schema/dynamic_schema_loader.py,sha256=J8Q_iJYhcSQLWyt0bTZCbDAGpxt9G8FCc6Q9jtGsNzw,10703
|
@@ -189,16 +189,11 @@ airbyte_cdk/sources/declarative/transformations/dpath_flatten_fields.py,sha256=1
|
|
189
189
|
airbyte_cdk/sources/declarative/transformations/flatten_fields.py,sha256=yT3owG6rMKaRX-LJ_T-jSTnh1B5NoAHyH4YZN9yOvE8,1758
|
190
190
|
airbyte_cdk/sources/declarative/transformations/keys_replace_transformation.py,sha256=vbIn6ump-Ut6g20yMub7PFoPBhOKVtrHSAUdcOUdLfw,1999
|
191
191
|
airbyte_cdk/sources/declarative/transformations/keys_to_lower_transformation.py,sha256=RTs5KX4V3hM7A6QN1WlGF21YccTIyNH6qQI9IMb__hw,670
|
192
|
-
airbyte_cdk/sources/declarative/transformations/keys_to_snake_transformation.py,sha256=
|
192
|
+
airbyte_cdk/sources/declarative/transformations/keys_to_snake_transformation.py,sha256=_3ldEbsA7tQK-zzeU_cG86D1_1SY3wAo1vHE0zXrOck,2265
|
193
193
|
airbyte_cdk/sources/declarative/transformations/remove_fields.py,sha256=EwUP0SZ2p4GRJ6Q8CUzlz9dcUeEidEFDlI2IBye2tlc,2745
|
194
194
|
airbyte_cdk/sources/declarative/transformations/transformation.py,sha256=4sXtx9cNY2EHUPq-xHvDs8GQEBUy3Eo6TkRLKHPXx68,1161
|
195
195
|
airbyte_cdk/sources/declarative/types.py,sha256=yqx0xlZv_76tkC7fqJKefmvl4GJJ8mXbeddwVV8XRJU,778
|
196
|
-
airbyte_cdk/sources/declarative/yaml_declarative_source.py,sha256=
|
197
|
-
airbyte_cdk/sources/embedded/__init__.py,sha256=ZnqYNxHsKCgO38IwB34RQyRMXTs4GTvlRi3ImKnIioo,61
|
198
|
-
airbyte_cdk/sources/embedded/base_integration.py,sha256=0LbtEtWlnVdkYlweA5OJU4BIoyS6d4le5w9FsLn25Zc,2417
|
199
|
-
airbyte_cdk/sources/embedded/catalog.py,sha256=EAnLw9u5fXLNBLfWr_I0itA7OEHMWdqEaM_rWc_tCpI,1653
|
200
|
-
airbyte_cdk/sources/embedded/runner.py,sha256=S6cz7SWRTFfT_ZhP-zZYdiT9XRijulV_bMABal2h0OI,1493
|
201
|
-
airbyte_cdk/sources/embedded/tools.py,sha256=kp26Au9xH4hxsnDQoavxE_a418ZrRUAMBr2MeOU52VI,746
|
196
|
+
airbyte_cdk/sources/declarative/yaml_declarative_source.py,sha256=swZUN7g_AuLeE7n1yp_cquK7DBB082lZUSMIBNEHxgs,2290
|
202
197
|
airbyte_cdk/sources/file_based/README.md,sha256=iMqww4VZ882jfNQIdljjDgqreKs-mkdtSrRKA94iX6A,11085
|
203
198
|
airbyte_cdk/sources/file_based/__init__.py,sha256=EaxHv_9ot-eRlUCR47ZMZ0IOtB-n0HH24om7Bfn-uuQ,868
|
204
199
|
airbyte_cdk/sources/file_based/availability_strategy/__init__.py,sha256=ddKQfUmk-Ls7LJaG8gtrqDybG3d8S7KXOAEjLeYLrTg,399
|
@@ -284,15 +279,16 @@ airbyte_cdk/sources/streams/concurrent/partitions/partition_generator.py,sha256=
|
|
284
279
|
airbyte_cdk/sources/streams/concurrent/partitions/stream_slicer.py,sha256=nbdkkHoN0NFeSs7YUFfzY1Lg5Jrt8fWY_ln3YrhY-Ko,544
|
285
280
|
airbyte_cdk/sources/streams/concurrent/partitions/types.py,sha256=frPVvHtY7vLxpGEbMQzNvF1Y52ZVyct9f1DDhGoRjwY,1166
|
286
281
|
airbyte_cdk/sources/streams/concurrent/state_converters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
287
|
-
airbyte_cdk/sources/streams/concurrent/state_converters/abstract_stream_state_converter.py,sha256=
|
282
|
+
airbyte_cdk/sources/streams/concurrent/state_converters/abstract_stream_state_converter.py,sha256=JCRanZBAC8a0pPuzHCHiJ1irHgFkDd83l2K5jA1xRkU,6853
|
288
283
|
airbyte_cdk/sources/streams/concurrent/state_converters/datetime_stream_state_converter.py,sha256=x8MLm1pTMfLNHvMF3P1ixYkYt_xjpbaIwnvhY_ofdBo,8076
|
284
|
+
airbyte_cdk/sources/streams/concurrent/state_converters/incrementing_count_stream_state_converter.py,sha256=bC6L82nsErXcFSPlxcdp4SneJ7qFuqCelP3-8svEh5E,3054
|
289
285
|
airbyte_cdk/sources/streams/core.py,sha256=jiYW6w8cjNjzXMd8U8Gt-02fYYU7b0ciXSSSnGvFRak,32219
|
290
286
|
airbyte_cdk/sources/streams/http/__init__.py,sha256=AGiEZ5B1Joi9ZnFpkJLT7F3QLpCAaBgAeVWy-1znmZw,311
|
291
287
|
airbyte_cdk/sources/streams/http/availability_strategy.py,sha256=sovoGFThZr-doMN9vJvTuJBrvkwQVIO0qTQO64pGZPY,2428
|
292
288
|
airbyte_cdk/sources/streams/http/error_handlers/__init__.py,sha256=nNO0bnD0ogDlR4AQrI-YmpcM911vWe83b7RJYgvjSYs,666
|
293
289
|
airbyte_cdk/sources/streams/http/error_handlers/backoff_strategy.py,sha256=7fIkF00wD6bqIXtiG2QAgbje_xiQ5JTs99ibwR8LLXY,1030
|
294
290
|
airbyte_cdk/sources/streams/http/error_handlers/default_backoff_strategy.py,sha256=1_1Gi2ImwTbh4SgIKCRh2P4kPaVeAeHc1ib6IrBfqKA,411
|
295
|
-
airbyte_cdk/sources/streams/http/error_handlers/default_error_mapping.py,sha256=
|
291
|
+
airbyte_cdk/sources/streams/http/error_handlers/default_error_mapping.py,sha256=drMniPygapMfOigh_ShJQvX6oqJaN4UA3cbRMkOgZJ4,3402
|
296
292
|
airbyte_cdk/sources/streams/http/error_handlers/error_handler.py,sha256=GuqP7U1eC9RPaiD4y4Mkf17vKcOXo2ENnMB-CUBLsbo,1164
|
297
293
|
airbyte_cdk/sources/streams/http/error_handlers/error_message_parser.py,sha256=xC93uB5BJd3iOnAXCrYLJTitWeGZlqzwe55VtsZqNnE,456
|
298
294
|
airbyte_cdk/sources/streams/http/error_handlers/http_status_error_handler.py,sha256=2gqececTxxUqO6aIkVNNXADg48Px5EHUwnXHL9KiPT8,4188
|
@@ -309,7 +305,7 @@ airbyte_cdk/sources/streams/http/requests_native_auth/oauth.py,sha256=C2j2uVfi9d
|
|
309
305
|
airbyte_cdk/sources/streams/http/requests_native_auth/token.py,sha256=h5PTzcdH-RQLeCg7xZ45w_484OPUDSwNWl_iMJQmZoI,2526
|
310
306
|
airbyte_cdk/sources/streams/permissions/identities_stream.py,sha256=9O9k6k18Xm3Zsiw_vnI_jsHXfMCQiek6V-jMkJJLxn8,2621
|
311
307
|
airbyte_cdk/sources/streams/utils/__init__.py,sha256=4Hw-PX1-VgESLF16cDdvuYCzGJtHntThLF4qIiULWeo,61
|
312
|
-
airbyte_cdk/sources/types.py,sha256=
|
308
|
+
airbyte_cdk/sources/types.py,sha256=x5Rkfpottg46qgr1-g_O4kN6v0Fd0sWHttdYsftyo7w,5148
|
313
309
|
airbyte_cdk/sources/utils/__init__.py,sha256=TTN6VUxVy6Is8BhYQZR5pxJGQh8yH4duXh4O1TiMiEY,118
|
314
310
|
airbyte_cdk/sources/utils/casing.py,sha256=QC-gV1O4e8DR4-bhdXieUPKm_JamzslVyfABLYYRSXA,256
|
315
311
|
airbyte_cdk/sources/utils/record_helper.py,sha256=jeB0mucudzna7Zvj-pCBbwFrbLJ36SlAWZTh5O4Fb9Y,2168
|
@@ -351,7 +347,7 @@ airbyte_cdk/utils/datetime_format_inferrer.py,sha256=Ne2cpk7Tx3eZDEW2Q3O7jnNOY9g
|
|
351
347
|
airbyte_cdk/utils/datetime_helpers.py,sha256=8mqzZ67Or2PBp7tLtrhh6XFv4wFzYsjCL_DOQJRaftI,17751
|
352
348
|
airbyte_cdk/utils/event_timing.py,sha256=aiuFmPU80buLlNdKq4fDTEqqhEIelHPF6AalFGwY8as,2557
|
353
349
|
airbyte_cdk/utils/is_cloud_environment.py,sha256=DayV32Irh-SdnJ0MnjvstwCJ66_l5oEsd8l85rZtHoc,574
|
354
|
-
airbyte_cdk/utils/mapping_helpers.py,sha256=
|
350
|
+
airbyte_cdk/utils/mapping_helpers.py,sha256=nWjOpnz_5QE9tY9-GtSWMPvYQL95kDD6k8KwwjUmrh0,6526
|
355
351
|
airbyte_cdk/utils/message_utils.py,sha256=OTzbkwN7AdMDA3iKYq1LKwfPFxpyEDfdgEF9BED3dkU,1366
|
356
352
|
airbyte_cdk/utils/oneof_option_config.py,sha256=N8EmWdYdwt0FM7fuShh6H8nj_r4KEL9tb2DJJtwsPow,1180
|
357
353
|
airbyte_cdk/utils/print_buffer.py,sha256=PhMOi0C4Z91kWKrSvCQXcp8qRh1uCimpIdvrg6voZIA,2810
|
@@ -360,9 +356,9 @@ airbyte_cdk/utils/slice_hasher.py,sha256=EDxgROHDbfG-QKQb59m7h_7crN1tRiawdf5uU7G
|
|
360
356
|
airbyte_cdk/utils/spec_schema_transformations.py,sha256=-5HTuNsnDBAhj-oLeQXwpTGA0HdcjFOf2zTEMUTTg_Y,816
|
361
357
|
airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
|
362
358
|
airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
|
363
|
-
airbyte_cdk-6.
|
364
|
-
airbyte_cdk-6.
|
365
|
-
airbyte_cdk-6.
|
366
|
-
airbyte_cdk-6.
|
367
|
-
airbyte_cdk-6.
|
368
|
-
airbyte_cdk-6.
|
359
|
+
airbyte_cdk-6.38.0.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
|
360
|
+
airbyte_cdk-6.38.0.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
|
361
|
+
airbyte_cdk-6.38.0.dist-info/METADATA,sha256=j7joeZ29JLG64WAacW_etS4UoRK2zb462sx04SsyFNU,6013
|
362
|
+
airbyte_cdk-6.38.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
363
|
+
airbyte_cdk-6.38.0.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
|
364
|
+
airbyte_cdk-6.38.0.dist-info/RECORD,,
|
@@ -1,61 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
|
3
|
-
#
|
4
|
-
|
5
|
-
from abc import ABC, abstractmethod
|
6
|
-
from typing import Generic, Iterable, Optional, TypeVar
|
7
|
-
|
8
|
-
from airbyte_cdk.connector import TConfig
|
9
|
-
from airbyte_cdk.models import AirbyteRecordMessage, AirbyteStateMessage, SyncMode, Type
|
10
|
-
from airbyte_cdk.sources.embedded.catalog import (
|
11
|
-
create_configured_catalog,
|
12
|
-
get_stream,
|
13
|
-
get_stream_names,
|
14
|
-
)
|
15
|
-
from airbyte_cdk.sources.embedded.runner import SourceRunner
|
16
|
-
from airbyte_cdk.sources.embedded.tools import get_defined_id
|
17
|
-
from airbyte_cdk.sources.utils.schema_helpers import check_config_against_spec_or_exit
|
18
|
-
|
19
|
-
TOutput = TypeVar("TOutput")
|
20
|
-
|
21
|
-
|
22
|
-
class BaseEmbeddedIntegration(ABC, Generic[TConfig, TOutput]):
|
23
|
-
def __init__(self, runner: SourceRunner[TConfig], config: TConfig):
|
24
|
-
check_config_against_spec_or_exit(config, runner.spec())
|
25
|
-
|
26
|
-
self.source = runner
|
27
|
-
self.config = config
|
28
|
-
|
29
|
-
self.last_state: Optional[AirbyteStateMessage] = None
|
30
|
-
|
31
|
-
@abstractmethod
|
32
|
-
def _handle_record(self, record: AirbyteRecordMessage, id: Optional[str]) -> Optional[TOutput]:
|
33
|
-
"""
|
34
|
-
Turn an Airbyte record into the appropriate output type for the integration.
|
35
|
-
"""
|
36
|
-
pass
|
37
|
-
|
38
|
-
def _load_data(
|
39
|
-
self, stream_name: str, state: Optional[AirbyteStateMessage] = None
|
40
|
-
) -> Iterable[TOutput]:
|
41
|
-
catalog = self.source.discover(self.config)
|
42
|
-
stream = get_stream(catalog, stream_name)
|
43
|
-
if not stream:
|
44
|
-
raise ValueError(
|
45
|
-
f"Stream {stream_name} not found, the following streams are available: {', '.join(get_stream_names(catalog))}"
|
46
|
-
)
|
47
|
-
if SyncMode.incremental not in stream.supported_sync_modes:
|
48
|
-
configured_catalog = create_configured_catalog(stream, sync_mode=SyncMode.full_refresh)
|
49
|
-
else:
|
50
|
-
configured_catalog = create_configured_catalog(stream, sync_mode=SyncMode.incremental)
|
51
|
-
|
52
|
-
for message in self.source.read(self.config, configured_catalog, state):
|
53
|
-
if message.type == Type.RECORD:
|
54
|
-
output = self._handle_record(
|
55
|
-
message.record,
|
56
|
-
get_defined_id(stream, message.record.data), # type: ignore[union-attr, arg-type]
|
57
|
-
)
|
58
|
-
if output:
|
59
|
-
yield output
|
60
|
-
elif message.type is Type.STATE and message.state:
|
61
|
-
self.last_state = message.state
|
@@ -1,57 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
|
3
|
-
#
|
4
|
-
|
5
|
-
from typing import List, Optional
|
6
|
-
|
7
|
-
from airbyte_cdk.models import (
|
8
|
-
AirbyteCatalog,
|
9
|
-
AirbyteStream,
|
10
|
-
ConfiguredAirbyteCatalog,
|
11
|
-
ConfiguredAirbyteStream,
|
12
|
-
DestinationSyncMode,
|
13
|
-
SyncMode,
|
14
|
-
)
|
15
|
-
from airbyte_cdk.sources.embedded.tools import get_first
|
16
|
-
|
17
|
-
|
18
|
-
def get_stream(catalog: AirbyteCatalog, stream_name: str) -> Optional[AirbyteStream]:
|
19
|
-
return get_first(catalog.streams, lambda s: s.name == stream_name)
|
20
|
-
|
21
|
-
|
22
|
-
def get_stream_names(catalog: AirbyteCatalog) -> List[str]:
|
23
|
-
return [stream.name for stream in catalog.streams]
|
24
|
-
|
25
|
-
|
26
|
-
def to_configured_stream(
|
27
|
-
stream: AirbyteStream,
|
28
|
-
sync_mode: SyncMode = SyncMode.full_refresh,
|
29
|
-
destination_sync_mode: DestinationSyncMode = DestinationSyncMode.append,
|
30
|
-
cursor_field: Optional[List[str]] = None,
|
31
|
-
primary_key: Optional[List[List[str]]] = None,
|
32
|
-
) -> ConfiguredAirbyteStream:
|
33
|
-
return ConfiguredAirbyteStream(
|
34
|
-
stream=stream,
|
35
|
-
sync_mode=sync_mode,
|
36
|
-
destination_sync_mode=destination_sync_mode,
|
37
|
-
cursor_field=cursor_field,
|
38
|
-
primary_key=primary_key,
|
39
|
-
)
|
40
|
-
|
41
|
-
|
42
|
-
def to_configured_catalog(
|
43
|
-
configured_streams: List[ConfiguredAirbyteStream],
|
44
|
-
) -> ConfiguredAirbyteCatalog:
|
45
|
-
return ConfiguredAirbyteCatalog(streams=configured_streams)
|
46
|
-
|
47
|
-
|
48
|
-
def create_configured_catalog(
|
49
|
-
stream: AirbyteStream, sync_mode: SyncMode = SyncMode.full_refresh
|
50
|
-
) -> ConfiguredAirbyteCatalog:
|
51
|
-
configured_streams = [
|
52
|
-
to_configured_stream(
|
53
|
-
stream, sync_mode=sync_mode, primary_key=stream.source_defined_primary_key
|
54
|
-
)
|
55
|
-
]
|
56
|
-
|
57
|
-
return to_configured_catalog(configured_streams)
|
@@ -1,57 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
|
3
|
-
#
|
4
|
-
|
5
|
-
|
6
|
-
import logging
|
7
|
-
from abc import ABC, abstractmethod
|
8
|
-
from typing import Generic, Iterable, Optional
|
9
|
-
|
10
|
-
from airbyte_cdk.connector import TConfig
|
11
|
-
from airbyte_cdk.models import (
|
12
|
-
AirbyteCatalog,
|
13
|
-
AirbyteMessage,
|
14
|
-
AirbyteStateMessage,
|
15
|
-
ConfiguredAirbyteCatalog,
|
16
|
-
ConnectorSpecification,
|
17
|
-
)
|
18
|
-
from airbyte_cdk.sources.source import Source
|
19
|
-
|
20
|
-
|
21
|
-
class SourceRunner(ABC, Generic[TConfig]):
|
22
|
-
@abstractmethod
|
23
|
-
def spec(self) -> ConnectorSpecification:
|
24
|
-
pass
|
25
|
-
|
26
|
-
@abstractmethod
|
27
|
-
def discover(self, config: TConfig) -> AirbyteCatalog:
|
28
|
-
pass
|
29
|
-
|
30
|
-
@abstractmethod
|
31
|
-
def read(
|
32
|
-
self,
|
33
|
-
config: TConfig,
|
34
|
-
catalog: ConfiguredAirbyteCatalog,
|
35
|
-
state: Optional[AirbyteStateMessage],
|
36
|
-
) -> Iterable[AirbyteMessage]:
|
37
|
-
pass
|
38
|
-
|
39
|
-
|
40
|
-
class CDKRunner(SourceRunner[TConfig]):
|
41
|
-
def __init__(self, source: Source, name: str):
|
42
|
-
self._source = source
|
43
|
-
self._logger = logging.getLogger(name)
|
44
|
-
|
45
|
-
def spec(self) -> ConnectorSpecification:
|
46
|
-
return self._source.spec(self._logger)
|
47
|
-
|
48
|
-
def discover(self, config: TConfig) -> AirbyteCatalog:
|
49
|
-
return self._source.discover(self._logger, config)
|
50
|
-
|
51
|
-
def read(
|
52
|
-
self,
|
53
|
-
config: TConfig,
|
54
|
-
catalog: ConfiguredAirbyteCatalog,
|
55
|
-
state: Optional[AirbyteStateMessage],
|
56
|
-
) -> Iterable[AirbyteMessage]:
|
57
|
-
return self._source.read(self._logger, config, catalog, state=[state] if state else [])
|
@@ -1,27 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
|
3
|
-
#
|
4
|
-
|
5
|
-
from typing import Any, Callable, Dict, Iterable, Optional
|
6
|
-
|
7
|
-
import dpath
|
8
|
-
|
9
|
-
from airbyte_cdk.models import AirbyteStream
|
10
|
-
|
11
|
-
|
12
|
-
def get_first(
|
13
|
-
iterable: Iterable[Any], predicate: Callable[[Any], bool] = lambda m: True
|
14
|
-
) -> Optional[Any]:
|
15
|
-
return next(filter(predicate, iterable), None)
|
16
|
-
|
17
|
-
|
18
|
-
def get_defined_id(stream: AirbyteStream, data: Dict[str, Any]) -> Optional[str]:
|
19
|
-
if not stream.source_defined_primary_key:
|
20
|
-
return None
|
21
|
-
primary_key = []
|
22
|
-
for key in stream.source_defined_primary_key:
|
23
|
-
try:
|
24
|
-
primary_key.append(str(dpath.get(data, key)))
|
25
|
-
except KeyError:
|
26
|
-
primary_key.append("__not_found__")
|
27
|
-
return "_".join(primary_key)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|