airbyte-cdk 6.7.0.dev11__py3-none-any.whl → 6.7.0rc2__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 +50 -18
- airbyte_cdk/sources/declarative/declarative_component_schema.yaml +13 -13
- airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py +15 -19
- {airbyte_cdk-6.7.0.dev11.dist-info → airbyte_cdk-6.7.0rc2.dist-info}/METADATA +2 -3
- {airbyte_cdk-6.7.0.dev11.dist-info → airbyte_cdk-6.7.0rc2.dist-info}/RECORD +7 -12
- airbyte_cdk/cli/__init__.py +0 -1
- airbyte_cdk/cli/source_declarative_manifest/__init__.py +0 -6
- airbyte_cdk/cli/source_declarative_manifest/_run.py +0 -223
- airbyte_cdk/cli/source_declarative_manifest/spec.json +0 -17
- airbyte_cdk-6.7.0.dev11.dist-info/entry_points.txt +0 -3
- {airbyte_cdk-6.7.0.dev11.dist-info → airbyte_cdk-6.7.0rc2.dist-info}/LICENSE.txt +0 -0
- {airbyte_cdk-6.7.0.dev11.dist-info → airbyte_cdk-6.7.0rc2.dist-info}/WHEEL +0 -0
@@ -48,6 +48,7 @@ from airbyte_cdk.sources.streams.concurrent.abstract_stream import AbstractStrea
|
|
48
48
|
from airbyte_cdk.sources.streams.concurrent.availability_strategy import (
|
49
49
|
AlwaysAvailableAvailabilityStrategy,
|
50
50
|
)
|
51
|
+
from airbyte_cdk.sources.streams.concurrent.cursor import Cursor, FinalStateCursor
|
51
52
|
from airbyte_cdk.sources.streams.concurrent.default_stream import DefaultStream
|
52
53
|
from airbyte_cdk.sources.streams.concurrent.helpers import get_primary_key_from_stream
|
53
54
|
|
@@ -193,31 +194,44 @@ class ConcurrentDeclarativeSource(ManifestDeclarativeSource, Generic[TState]):
|
|
193
194
|
declarative_stream.name
|
194
195
|
].get("incremental_sync")
|
195
196
|
|
196
|
-
|
197
|
+
is_without_partition_router_nor_cursor = not bool(
|
197
198
|
datetime_based_cursor_component_definition
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
199
|
+
) and not (
|
200
|
+
name_to_stream_mapping[declarative_stream.name]
|
201
|
+
.get("retriever", {})
|
202
|
+
.get("partition_router")
|
203
|
+
)
|
204
|
+
is_datetime_incremental_without_partition_routing = (
|
205
|
+
self._is_datetime_incremental_without_partition_routing(
|
206
|
+
datetime_based_cursor_component_definition, declarative_stream
|
202
207
|
)
|
203
|
-
|
204
|
-
|
208
|
+
)
|
209
|
+
if (
|
210
|
+
is_without_partition_router_nor_cursor
|
211
|
+
or is_datetime_incremental_without_partition_routing
|
205
212
|
):
|
206
213
|
stream_state = state_manager.get_stream_state(
|
207
214
|
stream_name=declarative_stream.name, namespace=declarative_stream.namespace
|
208
215
|
)
|
209
216
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
217
|
+
if is_datetime_incremental_without_partition_routing:
|
218
|
+
cursor: Cursor = (
|
219
|
+
self._constructor.create_concurrent_cursor_from_datetime_based_cursor(
|
220
|
+
state_manager=state_manager,
|
221
|
+
model_type=DatetimeBasedCursorModel,
|
222
|
+
component_definition=datetime_based_cursor_component_definition,
|
223
|
+
stream_name=declarative_stream.name,
|
224
|
+
stream_namespace=declarative_stream.namespace,
|
225
|
+
config=config or {},
|
226
|
+
stream_state=stream_state,
|
227
|
+
)
|
228
|
+
)
|
229
|
+
else:
|
230
|
+
cursor = FinalStateCursor(
|
231
|
+
declarative_stream.name,
|
232
|
+
declarative_stream.namespace,
|
233
|
+
self.message_repository,
|
219
234
|
)
|
220
|
-
)
|
221
235
|
|
222
236
|
partition_generator = StreamSlicerPartitionGenerator(
|
223
237
|
DeclarativePartitionFactory(
|
@@ -240,7 +254,9 @@ class ConcurrentDeclarativeSource(ManifestDeclarativeSource, Generic[TState]):
|
|
240
254
|
json_schema=declarative_stream.get_json_schema(),
|
241
255
|
availability_strategy=AlwaysAvailableAvailabilityStrategy(),
|
242
256
|
primary_key=get_primary_key_from_stream(declarative_stream.primary_key),
|
243
|
-
cursor_field=cursor.cursor_field.cursor_field_key
|
257
|
+
cursor_field=cursor.cursor_field.cursor_field_key
|
258
|
+
if hasattr(cursor, "cursor_field")
|
259
|
+
else None,
|
244
260
|
logger=self.logger,
|
245
261
|
cursor=cursor,
|
246
262
|
)
|
@@ -252,6 +268,22 @@ class ConcurrentDeclarativeSource(ManifestDeclarativeSource, Generic[TState]):
|
|
252
268
|
|
253
269
|
return concurrent_streams, synchronous_streams
|
254
270
|
|
271
|
+
def _is_datetime_incremental_without_partition_routing(
|
272
|
+
self,
|
273
|
+
datetime_based_cursor_component_definition: Mapping[str, Any],
|
274
|
+
declarative_stream: DeclarativeStream,
|
275
|
+
) -> bool:
|
276
|
+
return (
|
277
|
+
bool(datetime_based_cursor_component_definition)
|
278
|
+
and datetime_based_cursor_component_definition.get("type", "")
|
279
|
+
== DatetimeBasedCursorModel.__name__
|
280
|
+
and self._stream_supports_concurrent_partition_processing(
|
281
|
+
declarative_stream=declarative_stream
|
282
|
+
)
|
283
|
+
and hasattr(declarative_stream.retriever, "stream_slicer")
|
284
|
+
and isinstance(declarative_stream.retriever.stream_slicer, DatetimeBasedCursor)
|
285
|
+
)
|
286
|
+
|
255
287
|
def _stream_supports_concurrent_partition_processing(
|
256
288
|
self, declarative_stream: DeclarativeStream
|
257
289
|
) -> bool:
|
@@ -2790,21 +2790,21 @@ interpolation:
|
|
2790
2790
|
- created_at: "2020-01-01 00:00:00.000+00:00"
|
2791
2791
|
- updated_at: "2020-01-02 00:00:00.000+00:00"
|
2792
2792
|
macros:
|
2793
|
-
- title:
|
2793
|
+
- title: Now (UTC)
|
2794
2794
|
description: Returns the current date and time in the UTC timezone.
|
2795
2795
|
arguments: {}
|
2796
2796
|
return_type: Datetime
|
2797
2797
|
examples:
|
2798
2798
|
- "'{{ now_utc() }}' -> '2021-09-01 00:00:00+00:00'"
|
2799
2799
|
- "'{{ now_utc().strftime('%Y-%m-%d') }}' -> '2021-09-01'"
|
2800
|
-
- title:
|
2800
|
+
- title: Today (UTC)
|
2801
2801
|
description: Returns the current date in UTC timezone. The output is a date object.
|
2802
2802
|
arguments: {}
|
2803
2803
|
return_type: Date
|
2804
2804
|
examples:
|
2805
2805
|
- "'{{ today_utc() }}' -> '2021-09-01'"
|
2806
2806
|
- "'{{ today_utc().strftime('%Y/%m/%d')}}' -> '2021/09/01'"
|
2807
|
-
- title:
|
2807
|
+
- title: Timestamp
|
2808
2808
|
description: Converts a number or a string representing a datetime (formatted as ISO8601) to a timestamp. If the input is a number, it is converted to an int. If no timezone is specified, the string is interpreted as UTC.
|
2809
2809
|
arguments:
|
2810
2810
|
datetime: A string formatted as ISO8601 or an integer representing a unix timestamp
|
@@ -2815,7 +2815,7 @@ interpolation:
|
|
2815
2815
|
- "'{{ timestamp('2022-02-28T00:00:00Z') }}' -> 1646006400"
|
2816
2816
|
- "'{{ timestamp('2022-02-28 00:00:00Z') }}' -> 1646006400"
|
2817
2817
|
- "'{{ timestamp('2022-02-28T00:00:00-08:00') }}' -> 1646035200"
|
2818
|
-
- title:
|
2818
|
+
- title: Max
|
2819
2819
|
description: Returns the largest object of a iterable, or or two or more arguments.
|
2820
2820
|
arguments:
|
2821
2821
|
args: iterable or a sequence of two or more arguments
|
@@ -2823,7 +2823,7 @@ interpolation:
|
|
2823
2823
|
examples:
|
2824
2824
|
- "'{{ max(2, 3) }}' -> 3"
|
2825
2825
|
- "'{{ max([2, 3]) }}' -> 3"
|
2826
|
-
- title:
|
2826
|
+
- title: Day Delta
|
2827
2827
|
description: Returns the datetime of now() + num_days.
|
2828
2828
|
arguments:
|
2829
2829
|
num_days: The number of days to add to now
|
@@ -2833,8 +2833,8 @@ interpolation:
|
|
2833
2833
|
- "'{{ day_delta(1) }}' -> '2021-09-02T00:00:00.000000+0000'"
|
2834
2834
|
- "'{{ day_delta(-1) }}' -> '2021-08-31:00:00.000000+0000'"
|
2835
2835
|
- "'{{ day_delta(25, format='%Y-%m-%d') }}' -> '2021-09-02'"
|
2836
|
-
- title:
|
2837
|
-
description: Converts an ISO8601
|
2836
|
+
- title: Duration
|
2837
|
+
description: Converts an ISO8601 duratioin to datetime.timedelta.
|
2838
2838
|
arguments:
|
2839
2839
|
duration_string: "A string representing an ISO8601 duration. See https://www.digi.com/resources/documentation/digidocs//90001488-13/reference/r_iso_8601_duration_format.htm for more details."
|
2840
2840
|
return_type: datetime.timedelta
|
@@ -2842,7 +2842,7 @@ interpolation:
|
|
2842
2842
|
- "'{{ duration('P1D') }}' -> '1 day, 0:00:00'"
|
2843
2843
|
- "'{{ duration('P6DT23H') }}' -> '6 days, 23:00:00'"
|
2844
2844
|
- "'{{ (now_utc() - duration('P1D')).strftime('%Y-%m-%dT%H:%M:%SZ') }}' -> '2021-08-31T00:00:00Z'"
|
2845
|
-
- title:
|
2845
|
+
- title: Format Datetime
|
2846
2846
|
description: Converts a datetime or a datetime-string to the specified format.
|
2847
2847
|
arguments:
|
2848
2848
|
datetime: The datetime object or a string to convert. If datetime is a string, it must be formatted as ISO8601.
|
@@ -2854,7 +2854,7 @@ interpolation:
|
|
2854
2854
|
- "{{ format_datetime(config['start_date'], '%Y-%m-%dT%H:%M:%S.%fZ') }}"
|
2855
2855
|
- "{{ format_datetime(config['start_date'], '%Y-%m-%dT%H:%M:%S.%fZ', '%a, %d %b %Y %H:%M:%S %z') }}"
|
2856
2856
|
filters:
|
2857
|
-
- title:
|
2857
|
+
- title: Hash
|
2858
2858
|
description: Convert the specified value to a hashed string.
|
2859
2859
|
arguments:
|
2860
2860
|
hash_type: Valid hash type for converts ('md5' as default value).
|
@@ -2864,26 +2864,26 @@ interpolation:
|
|
2864
2864
|
- "{{ 'Test client_secret' | hash() }} -> '3032d57a12f76b61a820e47b9a5a0cbb'"
|
2865
2865
|
- "{{ 'Test client_secret' | hash('md5') }} -> '3032d57a12f76b61a820e47b9a5a0cbb'"
|
2866
2866
|
- "{{ 'Test client_secret' | hash('md5', salt='salt') }} -> '5011a0168579c2d94cbbe1c6ad14327c'"
|
2867
|
-
- title:
|
2867
|
+
- title: Base64 encoder
|
2868
2868
|
description: Convert the specified value to a string in the base64 format.
|
2869
2869
|
arguments: {}
|
2870
2870
|
return_type: str
|
2871
2871
|
examples:
|
2872
2872
|
- "{{ 'Test client_secret' | base64encode }} -> 'VGVzdCBjbGllbnRfc2VjcmV0'"
|
2873
|
-
- title:
|
2873
|
+
- title: Base64 decoder
|
2874
2874
|
description: Decodes the specified base64 format value into a common string.
|
2875
2875
|
arguments: {}
|
2876
2876
|
return_type: str
|
2877
2877
|
examples:
|
2878
2878
|
- "{{ 'ZmFrZSByZWZyZXNoX3Rva2VuIHZhbHVl' | base64decode }} -> 'fake refresh_token value'"
|
2879
|
-
- title:
|
2879
|
+
- title: String
|
2880
2880
|
description: Converts the specified value to a string.
|
2881
2881
|
arguments: {}
|
2882
2882
|
return_type: str
|
2883
2883
|
examples:
|
2884
2884
|
- '{{ 1 | string }} -> "1"'
|
2885
2885
|
- '{{ ["hello", "world" | string }} -> "["hello", "world"]"'
|
2886
|
-
- title:
|
2886
|
+
- title: Regex Search
|
2887
2887
|
description: Match the input string against a regular expression and return the first match.
|
2888
2888
|
arguments:
|
2889
2889
|
regex: The regular expression to search for. It must include a capture group.
|
@@ -17,7 +17,6 @@ from typing import (
|
|
17
17
|
Mapping,
|
18
18
|
MutableMapping,
|
19
19
|
Optional,
|
20
|
-
Tuple,
|
21
20
|
Type,
|
22
21
|
Union,
|
23
22
|
get_args,
|
@@ -753,7 +752,7 @@ class ModelToComponentFactory:
|
|
753
752
|
config: Config,
|
754
753
|
stream_state: MutableMapping[str, Any],
|
755
754
|
**kwargs: Any,
|
756
|
-
) ->
|
755
|
+
) -> ConcurrentCursor:
|
757
756
|
component_type = component_definition.get("type")
|
758
757
|
if component_definition.get("type") != model_type.__name__:
|
759
758
|
raise ValueError(
|
@@ -884,23 +883,20 @@ class ModelToComponentFactory:
|
|
884
883
|
if evaluated_step:
|
885
884
|
step_length = parse_duration(evaluated_step)
|
886
885
|
|
887
|
-
return (
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
cursor_granularity=cursor_granularity,
|
902
|
-
),
|
903
|
-
connector_state_converter,
|
886
|
+
return ConcurrentCursor(
|
887
|
+
stream_name=stream_name,
|
888
|
+
stream_namespace=stream_namespace,
|
889
|
+
stream_state=stream_state,
|
890
|
+
message_repository=self._message_repository, # type: ignore # message_repository is always instantiated with a value by factory
|
891
|
+
connector_state_manager=state_manager,
|
892
|
+
connector_state_converter=connector_state_converter,
|
893
|
+
cursor_field=cursor_field,
|
894
|
+
slice_boundary_fields=slice_boundary_fields,
|
895
|
+
start=start_date, # type: ignore # Having issues w/ inspection for GapType and CursorValueType as shown in existing tests. Confirmed functionality is working in practice
|
896
|
+
end_provider=end_date_provider, # type: ignore # Having issues w/ inspection for GapType and CursorValueType as shown in existing tests. Confirmed functionality is working in practice
|
897
|
+
lookback_window=lookback_window,
|
898
|
+
slice_range=step_length,
|
899
|
+
cursor_granularity=cursor_granularity,
|
904
900
|
)
|
905
901
|
|
906
902
|
@staticmethod
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: airbyte-cdk
|
3
|
-
Version: 6.7.
|
3
|
+
Version: 6.7.0rc2
|
4
4
|
Summary: A framework for writing Airbyte Connectors.
|
5
5
|
Home-page: https://airbyte.com
|
6
6
|
License: MIT
|
@@ -37,7 +37,7 @@ Requires-Dist: fastavro (>=1.8.0,<1.9.0) ; extra == "file-based"
|
|
37
37
|
Requires-Dist: genson (==1.3.0)
|
38
38
|
Requires-Dist: isodate (>=0.6.1,<0.7.0)
|
39
39
|
Requires-Dist: jsonref (>=0.2,<0.3)
|
40
|
-
Requires-Dist: jsonschema (>=
|
40
|
+
Requires-Dist: jsonschema (>=3.2.0,<3.3.0)
|
41
41
|
Requires-Dist: langchain (==0.1.16) ; extra == "vector-db-based"
|
42
42
|
Requires-Dist: langchain_core (==0.1.42)
|
43
43
|
Requires-Dist: markdown ; extra == "file-based"
|
@@ -60,7 +60,6 @@ Requires-Dist: python-dateutil
|
|
60
60
|
Requires-Dist: python-snappy (==0.7.3) ; extra == "file-based"
|
61
61
|
Requires-Dist: python-ulid (>=3.0.0,<4.0.0)
|
62
62
|
Requires-Dist: pytz (==2024.1)
|
63
|
-
Requires-Dist: rapidfuzz (>=3.10.1,<4.0.0)
|
64
63
|
Requires-Dist: requests
|
65
64
|
Requires-Dist: requests_cache
|
66
65
|
Requires-Dist: serpyco-rs (>=1.10.2,<2.0.0)
|
@@ -1,8 +1,4 @@
|
|
1
1
|
airbyte_cdk/__init__.py,sha256=3BlW1O37s_grUaioVZvGj3hRsofR0tY4sMceu5ygylk,11550
|
2
|
-
airbyte_cdk/cli/__init__.py,sha256=Hu-1XT2KDoYjDF7-_ziDwv5bY3PueGjANOCbzeOegDg,57
|
3
|
-
airbyte_cdk/cli/source_declarative_manifest/__init__.py,sha256=_zFyFFl4leAvtnkHmBFbtLYT6Bh44qxmLbU0wnK2TZQ,92
|
4
|
-
airbyte_cdk/cli/source_declarative_manifest/_run.py,sha256=3rIz-W65J6c2g3eMvvh2jk00cBBTiSgxx-MqA9WPUkw,7769
|
5
|
-
airbyte_cdk/cli/source_declarative_manifest/spec.json,sha256=Earc1L6ngcdIr514oFQlUoOxdF4RHqtUyStSIAquXdY,554
|
6
2
|
airbyte_cdk/config_observation.py,sha256=A2P475pS9JndFzBggtkkAmcN1aMeq_thRbXRzmWjI3E,3997
|
7
3
|
airbyte_cdk/connector.py,sha256=srfjRNgkt1nsPw-Mm0d1qXoVmM90zHPYHIfxu8p6JXI,4223
|
8
4
|
airbyte_cdk/connector_builder/README.md,sha256=Hw3wvVewuHG9-QgsAq1jDiKuLlStDxKBz52ftyNRnBw,1665
|
@@ -62,11 +58,11 @@ airbyte_cdk/sources/declarative/checks/check_stream.py,sha256=dAA-UhmMj0WLXCkRQr
|
|
62
58
|
airbyte_cdk/sources/declarative/checks/connection_checker.py,sha256=MBRJo6WJlZQHpIfOGaNOkkHUmgUl_4wDM6VPo41z5Ss,1383
|
63
59
|
airbyte_cdk/sources/declarative/concurrency_level/__init__.py,sha256=5XUqrmlstYlMM0j6crktlKQwALek0uiz2D3WdM46MyA,191
|
64
60
|
airbyte_cdk/sources/declarative/concurrency_level/concurrency_level.py,sha256=YIwCTCpOr_QSNW4ltQK0yUGWInI8PKNY216HOOegYLk,2101
|
65
|
-
airbyte_cdk/sources/declarative/concurrent_declarative_source.py,sha256=
|
61
|
+
airbyte_cdk/sources/declarative/concurrent_declarative_source.py,sha256=hbHylluHcEexCFonA0fYuTQl7gDhU3uwNkn-CgvuYl8,21198
|
66
62
|
airbyte_cdk/sources/declarative/datetime/__init__.py,sha256=l9LG7Qm6e5r_qgqfVKnx3mXYtg1I9MmMjomVIPfU4XA,177
|
67
63
|
airbyte_cdk/sources/declarative/datetime/datetime_parser.py,sha256=SX9JjdesN1edN2WVUVMzU_ptqp2QB1OnsnjZ4mwcX7w,2579
|
68
64
|
airbyte_cdk/sources/declarative/datetime/min_max_datetime.py,sha256=8VZJP18eJLabSPP1XBSPDaagUBG6q1ynIiPJy3rE2mc,5344
|
69
|
-
airbyte_cdk/sources/declarative/declarative_component_schema.yaml,sha256=
|
65
|
+
airbyte_cdk/sources/declarative/declarative_component_schema.yaml,sha256=QGpwBEd-KZIeUwtWiZNvRW9SbG4SLGveZHRjAgUk7mg,110383
|
70
66
|
airbyte_cdk/sources/declarative/declarative_source.py,sha256=nF7wBqFd3AQmEKAm4CnIo29CJoQL562cJGSCeL8U8bA,1531
|
71
67
|
airbyte_cdk/sources/declarative/declarative_stream.py,sha256=JRyNeOIpsFu4ztVZsN6sncqUEIqIE-bUkD2TPgbMgk0,10375
|
72
68
|
airbyte_cdk/sources/declarative/decoders/__init__.py,sha256=hNlhaB5FjNC6IfJyglj5ZJWkYD2nEAukMDmzRz5PC6o,671
|
@@ -109,7 +105,7 @@ airbyte_cdk/sources/declarative/parsers/__init__.py,sha256=ZnqYNxHsKCgO38IwB34RQ
|
|
109
105
|
airbyte_cdk/sources/declarative/parsers/custom_exceptions.py,sha256=Rir9_z3Kcd5Es0-LChrzk-0qubAsiK_RSEnLmK2OXm8,553
|
110
106
|
airbyte_cdk/sources/declarative/parsers/manifest_component_transformer.py,sha256=jVZ3ZV5YZrmDNIX5cM2mugXmnbH27zHRcD22_3oatpo,8454
|
111
107
|
airbyte_cdk/sources/declarative/parsers/manifest_reference_resolver.py,sha256=IWUOdF03o-aQn0Occo1BJCxU0Pz-QILk5L67nzw2thw,6803
|
112
|
-
airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=
|
108
|
+
airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=ffPS6F7qPOoFNJDgC1wbvRjM4wC7UshLJ1Trde3Xjyc,95235
|
113
109
|
airbyte_cdk/sources/declarative/partition_routers/__init__.py,sha256=8uGos2u7TFTx_EJBdcjdUGn3Eyx6jUuEa1_VB8UP_dI,631
|
114
110
|
airbyte_cdk/sources/declarative/partition_routers/cartesian_product_stream_slicer.py,sha256=c5cuVFM6NFkuQqG8Z5IwkBuwDrvXZN1CunUOM_L0ezg,6892
|
115
111
|
airbyte_cdk/sources/declarative/partition_routers/list_partition_router.py,sha256=t7pRdFWfFWJtQQG19c9PVeMODyO2BknRTakpM5U9N-8,4844
|
@@ -331,8 +327,7 @@ airbyte_cdk/utils/slice_hasher.py,sha256=EemcgcQlI8-LPYOPlYv4Qkdjyho79XVLWaUHF5X
|
|
331
327
|
airbyte_cdk/utils/spec_schema_transformations.py,sha256=LVc9KbtMeV_z99jWo0Ou8u4l6eBJ0BWNhxj4zrrGKRs,763
|
332
328
|
airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
|
333
329
|
airbyte_cdk/utils/traced_exception.py,sha256=89TQdFuYZ1NJgmFpqLzY_T_T_64TpJYmVqs119Bp43g,6164
|
334
|
-
airbyte_cdk-6.7.
|
335
|
-
airbyte_cdk-6.7.
|
336
|
-
airbyte_cdk-6.7.
|
337
|
-
airbyte_cdk-6.7.
|
338
|
-
airbyte_cdk-6.7.0.dev11.dist-info/RECORD,,
|
330
|
+
airbyte_cdk-6.7.0rc2.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
|
331
|
+
airbyte_cdk-6.7.0rc2.dist-info/METADATA,sha256=0dmVuMrkaui3uUXZp0tg1CfHzY58AHUPJGAGQhk4VRw,13300
|
332
|
+
airbyte_cdk-6.7.0rc2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
333
|
+
airbyte_cdk-6.7.0rc2.dist-info/RECORD,,
|
airbyte_cdk/cli/__init__.py
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
|
@@ -1,223 +0,0 @@
|
|
1
|
-
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
|
2
|
-
"""Defines the `source-declarative-manifest` connector, which installs alongside CDK.
|
3
|
-
|
4
|
-
This file was originally imported from the dedicated connector directory, under the
|
5
|
-
`airbyte` monorepo.
|
6
|
-
|
7
|
-
Usage:
|
8
|
-
|
9
|
-
```
|
10
|
-
pipx install airbyte-cdk
|
11
|
-
source-declarative-manifest --help
|
12
|
-
source-declarative-manifest spec
|
13
|
-
...
|
14
|
-
```
|
15
|
-
"""
|
16
|
-
|
17
|
-
from __future__ import annotations
|
18
|
-
|
19
|
-
import json
|
20
|
-
import pkgutil
|
21
|
-
import sys
|
22
|
-
import traceback
|
23
|
-
from collections.abc import Mapping
|
24
|
-
from datetime import datetime
|
25
|
-
from pathlib import Path
|
26
|
-
from typing import Any, cast
|
27
|
-
|
28
|
-
from airbyte_cdk.entrypoint import AirbyteEntrypoint, launch
|
29
|
-
from airbyte_cdk.models import (
|
30
|
-
AirbyteErrorTraceMessage,
|
31
|
-
AirbyteMessage,
|
32
|
-
AirbyteMessageSerializer,
|
33
|
-
AirbyteStateMessage,
|
34
|
-
AirbyteTraceMessage,
|
35
|
-
ConfiguredAirbyteCatalog,
|
36
|
-
ConnectorSpecificationSerializer,
|
37
|
-
TraceType,
|
38
|
-
Type,
|
39
|
-
)
|
40
|
-
from airbyte_cdk.sources.declarative.concurrent_declarative_source import (
|
41
|
-
ConcurrentDeclarativeSource,
|
42
|
-
)
|
43
|
-
from airbyte_cdk.sources.declarative.yaml_declarative_source import YamlDeclarativeSource
|
44
|
-
from airbyte_cdk.sources.source import TState
|
45
|
-
from orjson import orjson
|
46
|
-
|
47
|
-
|
48
|
-
class SourceLocalYaml(YamlDeclarativeSource):
|
49
|
-
"""
|
50
|
-
Declarative source defined by a yaml file in the local filesystem
|
51
|
-
"""
|
52
|
-
|
53
|
-
def __init__(
|
54
|
-
self,
|
55
|
-
catalog: ConfiguredAirbyteCatalog | None,
|
56
|
-
config: Mapping[str, Any] | None,
|
57
|
-
state: TState,
|
58
|
-
**kwargs: Any,
|
59
|
-
) -> None:
|
60
|
-
"""
|
61
|
-
HACK!
|
62
|
-
Problem: YamlDeclarativeSource relies on the calling module name/path to find the yaml file.
|
63
|
-
Implication: If you call YamlDeclarativeSource directly it will look for the yaml file in the wrong place. (e.g. the airbyte-cdk package)
|
64
|
-
Solution: Subclass YamlDeclarativeSource from the same location as the manifest to load.
|
65
|
-
|
66
|
-
When can we remove this?
|
67
|
-
When the airbyte-cdk is updated to not rely on the calling module name/path to find the yaml file.
|
68
|
-
When all manifest connectors are updated to use the new airbyte-cdk.
|
69
|
-
When all manifest connectors are updated to use the source-declarative-manifest as the base image.
|
70
|
-
"""
|
71
|
-
super().__init__(
|
72
|
-
catalog=catalog,
|
73
|
-
config=config,
|
74
|
-
state=state,
|
75
|
-
path_to_yaml="manifest.yaml",
|
76
|
-
)
|
77
|
-
|
78
|
-
|
79
|
-
def _is_local_manifest_command(args: list[str]) -> bool:
|
80
|
-
# Check for a local manifest.yaml file
|
81
|
-
return Path("/airbyte/integration_code/source_declarative_manifest/manifest.yaml").exists()
|
82
|
-
|
83
|
-
|
84
|
-
def handle_command(args: list[str]) -> None:
|
85
|
-
if _is_local_manifest_command(args):
|
86
|
-
handle_local_manifest_command(args)
|
87
|
-
else:
|
88
|
-
handle_remote_manifest_command(args)
|
89
|
-
|
90
|
-
|
91
|
-
def _get_local_yaml_source(args: list[str]) -> SourceLocalYaml:
|
92
|
-
try:
|
93
|
-
config, catalog, state = _parse_inputs_into_config_catalog_state(args)
|
94
|
-
return SourceLocalYaml(config=config, catalog=catalog, state=state)
|
95
|
-
except Exception as error:
|
96
|
-
print(
|
97
|
-
orjson.dumps(
|
98
|
-
AirbyteMessageSerializer.dump(
|
99
|
-
AirbyteMessage(
|
100
|
-
type=Type.TRACE,
|
101
|
-
trace=AirbyteTraceMessage(
|
102
|
-
type=TraceType.ERROR,
|
103
|
-
emitted_at=int(datetime.now().timestamp() * 1000),
|
104
|
-
error=AirbyteErrorTraceMessage(
|
105
|
-
message=f"Error starting the sync. This could be due to an invalid configuration or catalog. Please contact Support for assistance. Error: {error}",
|
106
|
-
stack_trace=traceback.format_exc(),
|
107
|
-
),
|
108
|
-
),
|
109
|
-
)
|
110
|
-
)
|
111
|
-
).decode()
|
112
|
-
)
|
113
|
-
raise error
|
114
|
-
|
115
|
-
|
116
|
-
def handle_local_manifest_command(args: list[str]) -> None:
|
117
|
-
source = _get_local_yaml_source(args)
|
118
|
-
launch(
|
119
|
-
source=source,
|
120
|
-
args=args,
|
121
|
-
)
|
122
|
-
|
123
|
-
|
124
|
-
def handle_remote_manifest_command(args: list[str]) -> None:
|
125
|
-
"""Overrides the spec command to return the generalized spec for the declarative manifest source.
|
126
|
-
|
127
|
-
This is different from a typical low-code, but built and published separately source built as a ManifestDeclarativeSource,
|
128
|
-
because that will have a spec method that returns the spec for that specific source. Other than spec,
|
129
|
-
the generalized connector behaves the same as any other, since the manifest is provided in the config.
|
130
|
-
"""
|
131
|
-
if args[0] == "spec":
|
132
|
-
json_spec = pkgutil.get_data(
|
133
|
-
"airbyte_cdk.cli.source_declarative_manifest",
|
134
|
-
"spec.json",
|
135
|
-
)
|
136
|
-
if json_spec is None:
|
137
|
-
raise FileNotFoundError(
|
138
|
-
"Could not find `spec.json` file for source-declarative-manifest"
|
139
|
-
)
|
140
|
-
|
141
|
-
spec_obj = json.loads(json_spec)
|
142
|
-
spec = ConnectorSpecificationSerializer.load(spec_obj)
|
143
|
-
|
144
|
-
message = AirbyteMessage(type=Type.SPEC, spec=spec)
|
145
|
-
print(AirbyteEntrypoint.airbyte_message_to_string(message))
|
146
|
-
else:
|
147
|
-
source = create_declarative_source(args)
|
148
|
-
launch(
|
149
|
-
source=source,
|
150
|
-
args=args,
|
151
|
-
)
|
152
|
-
|
153
|
-
|
154
|
-
def create_declarative_source(args: list[str]) -> ConcurrentDeclarativeSource:
|
155
|
-
"""Creates the source with the injected config.
|
156
|
-
|
157
|
-
This essentially does what other low-code sources do at build time, but at runtime,
|
158
|
-
with a user-provided manifest in the config. This better reflects what happens in the
|
159
|
-
connector builder.
|
160
|
-
"""
|
161
|
-
try:
|
162
|
-
config, catalog, state = _parse_inputs_into_config_catalog_state(args)
|
163
|
-
if "__injected_declarative_manifest" not in config:
|
164
|
-
raise ValueError(
|
165
|
-
f"Invalid config: `__injected_declarative_manifest` should be provided at the root of the config but config only has keys {list(config.keys())}"
|
166
|
-
)
|
167
|
-
return ConcurrentDeclarativeSource(
|
168
|
-
config=config,
|
169
|
-
catalog=catalog,
|
170
|
-
state=state,
|
171
|
-
source_config=cast(dict[str, Any], config["__injected_declarative_manifest"]),
|
172
|
-
)
|
173
|
-
except Exception as error:
|
174
|
-
print(
|
175
|
-
orjson.dumps(
|
176
|
-
AirbyteMessageSerializer.dump(
|
177
|
-
AirbyteMessage(
|
178
|
-
type=Type.TRACE,
|
179
|
-
trace=AirbyteTraceMessage(
|
180
|
-
type=TraceType.ERROR,
|
181
|
-
emitted_at=int(datetime.now().timestamp() * 1000),
|
182
|
-
error=AirbyteErrorTraceMessage(
|
183
|
-
message=f"Error starting the sync. This could be due to an invalid configuration or catalog. Please contact Support for assistance. Error: {error}",
|
184
|
-
stack_trace=traceback.format_exc(),
|
185
|
-
),
|
186
|
-
),
|
187
|
-
)
|
188
|
-
)
|
189
|
-
).decode()
|
190
|
-
)
|
191
|
-
raise error
|
192
|
-
|
193
|
-
|
194
|
-
def _parse_inputs_into_config_catalog_state(
|
195
|
-
args: list[str],
|
196
|
-
) -> tuple[
|
197
|
-
Mapping[str, Any] | None,
|
198
|
-
ConfiguredAirbyteCatalog | None,
|
199
|
-
list[AirbyteStateMessage],
|
200
|
-
]:
|
201
|
-
parsed_args = AirbyteEntrypoint.parse_args(args)
|
202
|
-
config = (
|
203
|
-
ConcurrentDeclarativeSource.read_config(parsed_args.config)
|
204
|
-
if hasattr(parsed_args, "config")
|
205
|
-
else None
|
206
|
-
)
|
207
|
-
catalog = (
|
208
|
-
ConcurrentDeclarativeSource.read_catalog(parsed_args.catalog)
|
209
|
-
if hasattr(parsed_args, "catalog")
|
210
|
-
else None
|
211
|
-
)
|
212
|
-
state = (
|
213
|
-
ConcurrentDeclarativeSource.read_state(parsed_args.state)
|
214
|
-
if hasattr(parsed_args, "state")
|
215
|
-
else []
|
216
|
-
)
|
217
|
-
|
218
|
-
return config, catalog, state
|
219
|
-
|
220
|
-
|
221
|
-
def run() -> None:
|
222
|
-
args: list[str] = sys.argv[1:]
|
223
|
-
handle_command(args)
|
@@ -1,17 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"documentationUrl": "https://docs.airbyte.com/integrations/sources/low-code",
|
3
|
-
"connectionSpecification": {
|
4
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
5
|
-
"title": "Low-code source spec",
|
6
|
-
"type": "object",
|
7
|
-
"required": ["__injected_declarative_manifest"],
|
8
|
-
"additionalProperties": true,
|
9
|
-
"properties": {
|
10
|
-
"__injected_declarative_manifest": {
|
11
|
-
"title": "Low-code manifest",
|
12
|
-
"type": "object",
|
13
|
-
"description": "The low-code manifest that defines the components of the source."
|
14
|
-
}
|
15
|
-
}
|
16
|
-
}
|
17
|
-
}
|
File without changes
|
File without changes
|