airbyte-cdk 6.17.1.dev0__py3-none-any.whl → 6.17.1.dev1__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/incremental/concurrent_partition_cursor.py +4 -10
- airbyte_cdk/sources/declarative/incremental/per_partition_cursor.py +2 -1
- airbyte_cdk/sources/streams/concurrent/cursor.py +30 -21
- {airbyte_cdk-6.17.1.dev0.dist-info → airbyte_cdk-6.17.1.dev1.dist-info}/METADATA +1 -1
- {airbyte_cdk-6.17.1.dev0.dist-info → airbyte_cdk-6.17.1.dev1.dist-info}/RECORD +8 -8
- {airbyte_cdk-6.17.1.dev0.dist-info → airbyte_cdk-6.17.1.dev1.dist-info}/LICENSE.txt +0 -0
- {airbyte_cdk-6.17.1.dev0.dist-info → airbyte_cdk-6.17.1.dev1.dist-info}/WHEEL +0 -0
- {airbyte_cdk-6.17.1.dev0.dist-info → airbyte_cdk-6.17.1.dev1.dist-info}/entry_points.txt +0 -0
@@ -107,14 +107,11 @@ class ConcurrentPerPartitionCursor(Cursor):
|
|
107
107
|
def state(self) -> MutableMapping[str, Any]:
|
108
108
|
states = []
|
109
109
|
for partition_tuple, cursor in self._cursor_per_partition.items():
|
110
|
-
|
111
|
-
self.cursor_field, cursor.state
|
112
|
-
)
|
113
|
-
if cursor_state:
|
110
|
+
if cursor.state:
|
114
111
|
states.append(
|
115
112
|
{
|
116
113
|
"partition": self._to_dict(partition_tuple),
|
117
|
-
"cursor": copy.deepcopy(
|
114
|
+
"cursor": copy.deepcopy(cursor.state),
|
118
115
|
}
|
119
116
|
)
|
120
117
|
state: dict[str, Any] = {"states": states}
|
@@ -138,9 +135,6 @@ class ConcurrentPerPartitionCursor(Cursor):
|
|
138
135
|
cursor = self._cursor_per_partition[
|
139
136
|
self._to_partition_key(partition._stream_slice.partition)
|
140
137
|
]
|
141
|
-
cursor_state = cursor._connector_state_converter.convert_to_state_message(
|
142
|
-
cursor._cursor_field, cursor.state
|
143
|
-
)
|
144
138
|
if (
|
145
139
|
self._to_partition_key(partition._stream_slice.partition)
|
146
140
|
in self._finished_partitions
|
@@ -152,9 +146,9 @@ class ConcurrentPerPartitionCursor(Cursor):
|
|
152
146
|
if (
|
153
147
|
self._new_global_cursor is None
|
154
148
|
or self._new_global_cursor[self.cursor_field.cursor_field_key]
|
155
|
-
<
|
149
|
+
< cursor.state[self.cursor_field.cursor_field_key]
|
156
150
|
):
|
157
|
-
self._new_global_cursor = copy.deepcopy(
|
151
|
+
self._new_global_cursor = copy.deepcopy(cursor.state)
|
158
152
|
|
159
153
|
def ensure_at_least_one_state_emitted(self) -> None:
|
160
154
|
"""
|
@@ -304,7 +304,8 @@ class PerPartitionCursor(DeclarativeCursor):
|
|
304
304
|
|
305
305
|
def should_be_synced(self, record: Record) -> bool:
|
306
306
|
if (
|
307
|
-
|
307
|
+
record.associated_slice
|
308
|
+
and self._to_partition_key(record.associated_slice.partition)
|
308
309
|
not in self._cursor_per_partition
|
309
310
|
):
|
310
311
|
partition_state = (
|
@@ -196,7 +196,9 @@ class ConcurrentCursor(Cursor):
|
|
196
196
|
|
197
197
|
@property
|
198
198
|
def state(self) -> MutableMapping[str, Any]:
|
199
|
-
return self.
|
199
|
+
return self._connector_state_converter.convert_to_state_message(
|
200
|
+
self.cursor_field, self._concurrent_state
|
201
|
+
)
|
200
202
|
|
201
203
|
@property
|
202
204
|
def cursor_field(self) -> CursorField:
|
@@ -241,10 +243,10 @@ class ConcurrentCursor(Cursor):
|
|
241
243
|
return self._connector_state_converter.parse_value(self._cursor_field.extract_value(record))
|
242
244
|
|
243
245
|
def close_partition(self, partition: Partition) -> None:
|
244
|
-
slice_count_before = len(self.
|
246
|
+
slice_count_before = len(self._concurrent_state.get("slices", []))
|
245
247
|
self._add_slice_to_state(partition)
|
246
248
|
if slice_count_before < len(
|
247
|
-
self.
|
249
|
+
self._concurrent_state["slices"]
|
248
250
|
): # only emit if at least one slice has been processed
|
249
251
|
self._merge_partitions()
|
250
252
|
self._emit_state_message()
|
@@ -256,11 +258,11 @@ class ConcurrentCursor(Cursor):
|
|
256
258
|
)
|
257
259
|
|
258
260
|
if self._slice_boundary_fields:
|
259
|
-
if "slices" not in self.
|
261
|
+
if "slices" not in self._concurrent_state:
|
260
262
|
raise RuntimeError(
|
261
263
|
f"The state for stream {self._stream_name} should have at least one slice to delineate the sync start time, but no slices are present. This is unexpected. Please contact Support."
|
262
264
|
)
|
263
|
-
self.
|
265
|
+
self._concurrent_state["slices"].append(
|
264
266
|
{
|
265
267
|
self._connector_state_converter.START_KEY: self._extract_from_slice(
|
266
268
|
partition, self._slice_boundary_fields[self._START_BOUNDARY]
|
@@ -288,7 +290,7 @@ class ConcurrentCursor(Cursor):
|
|
288
290
|
"expected. Please contact the Airbyte team."
|
289
291
|
)
|
290
292
|
|
291
|
-
self.
|
293
|
+
self._concurrent_state["slices"].append(
|
292
294
|
{
|
293
295
|
self._connector_state_converter.START_KEY: self.start,
|
294
296
|
self._connector_state_converter.END_KEY: most_recent_cursor_value,
|
@@ -300,9 +302,7 @@ class ConcurrentCursor(Cursor):
|
|
300
302
|
self._connector_state_manager.update_state_for_stream(
|
301
303
|
self._stream_name,
|
302
304
|
self._stream_namespace,
|
303
|
-
self.
|
304
|
-
self._cursor_field, self.state
|
305
|
-
),
|
305
|
+
self.state,
|
306
306
|
)
|
307
307
|
state_message = self._connector_state_manager.create_state_message(
|
308
308
|
self._stream_name, self._stream_namespace
|
@@ -310,7 +310,9 @@ class ConcurrentCursor(Cursor):
|
|
310
310
|
self._message_repository.emit_message(state_message)
|
311
311
|
|
312
312
|
def _merge_partitions(self) -> None:
|
313
|
-
self.
|
313
|
+
self._concurrent_state["slices"] = self._connector_state_converter.merge_intervals(
|
314
|
+
self._concurrent_state["slices"]
|
315
|
+
)
|
314
316
|
|
315
317
|
def _extract_from_slice(self, partition: Partition, key: str) -> CursorValueType:
|
316
318
|
try:
|
@@ -347,36 +349,42 @@ class ConcurrentCursor(Cursor):
|
|
347
349
|
if self._start is not None and self._is_start_before_first_slice():
|
348
350
|
yield from self._split_per_slice_range(
|
349
351
|
self._start,
|
350
|
-
self.
|
352
|
+
self._concurrent_state["slices"][0][self._connector_state_converter.START_KEY],
|
351
353
|
False,
|
352
354
|
)
|
353
355
|
|
354
|
-
if len(self.
|
356
|
+
if len(self._concurrent_state["slices"]) == 1:
|
355
357
|
yield from self._split_per_slice_range(
|
356
358
|
self._calculate_lower_boundary_of_last_slice(
|
357
|
-
self.
|
359
|
+
self._concurrent_state["slices"][0][self._connector_state_converter.END_KEY]
|
358
360
|
),
|
359
361
|
self._end_provider(),
|
360
362
|
True,
|
361
363
|
)
|
362
|
-
elif len(self.
|
363
|
-
for i in range(len(self.
|
364
|
+
elif len(self._concurrent_state["slices"]) > 1:
|
365
|
+
for i in range(len(self._concurrent_state["slices"]) - 1):
|
364
366
|
if self._cursor_granularity:
|
365
367
|
yield from self._split_per_slice_range(
|
366
|
-
self.
|
368
|
+
self._concurrent_state["slices"][i][self._connector_state_converter.END_KEY]
|
367
369
|
+ self._cursor_granularity,
|
368
|
-
self.
|
370
|
+
self._concurrent_state["slices"][i + 1][
|
371
|
+
self._connector_state_converter.START_KEY
|
372
|
+
],
|
369
373
|
False,
|
370
374
|
)
|
371
375
|
else:
|
372
376
|
yield from self._split_per_slice_range(
|
373
|
-
self.
|
374
|
-
|
377
|
+
self._concurrent_state["slices"][i][
|
378
|
+
self._connector_state_converter.END_KEY
|
379
|
+
],
|
380
|
+
self._concurrent_state["slices"][i + 1][
|
381
|
+
self._connector_state_converter.START_KEY
|
382
|
+
],
|
375
383
|
False,
|
376
384
|
)
|
377
385
|
yield from self._split_per_slice_range(
|
378
386
|
self._calculate_lower_boundary_of_last_slice(
|
379
|
-
self.
|
387
|
+
self._concurrent_state["slices"][-1][self._connector_state_converter.END_KEY]
|
380
388
|
),
|
381
389
|
self._end_provider(),
|
382
390
|
True,
|
@@ -387,7 +395,8 @@ class ConcurrentCursor(Cursor):
|
|
387
395
|
def _is_start_before_first_slice(self) -> bool:
|
388
396
|
return (
|
389
397
|
self._start is not None
|
390
|
-
and self._start
|
398
|
+
and self._start
|
399
|
+
< self._concurrent_state["slices"][0][self._connector_state_converter.START_KEY]
|
391
400
|
)
|
392
401
|
|
393
402
|
def _calculate_lower_boundary_of_last_slice(
|
@@ -86,11 +86,11 @@ airbyte_cdk/sources/declarative/extractors/record_selector.py,sha256=tjNwcURmlyD
|
|
86
86
|
airbyte_cdk/sources/declarative/extractors/response_to_file_extractor.py,sha256=LhqGDfX06_dDYLKsIVnwQ_nAWCln-v8PV7Wgt_QVeTI,6533
|
87
87
|
airbyte_cdk/sources/declarative/extractors/type_transformer.py,sha256=d6Y2Rfg8pMVEEnHllfVksWZdNVOU55yk34O03dP9muY,1626
|
88
88
|
airbyte_cdk/sources/declarative/incremental/__init__.py,sha256=U1oZKtBaEC6IACmvziY9Wzg7Z8EgF4ZuR7NwvjlB_Sk,1255
|
89
|
-
airbyte_cdk/sources/declarative/incremental/concurrent_partition_cursor.py,sha256=
|
89
|
+
airbyte_cdk/sources/declarative/incremental/concurrent_partition_cursor.py,sha256=vU6bcVgjDFou7szl5UKxv2-theKSsV78oSME84-C78A,15043
|
90
90
|
airbyte_cdk/sources/declarative/incremental/datetime_based_cursor.py,sha256=_UzUnSIUsDbRgbFTXgSyZEFb4ws-KdhdQPWO8mFbV7U,22028
|
91
91
|
airbyte_cdk/sources/declarative/incremental/declarative_cursor.py,sha256=5Bhw9VRPyIuCaD0wmmq_L3DZsa-rJgtKSEUzSd8YYD0,536
|
92
92
|
airbyte_cdk/sources/declarative/incremental/global_substream_cursor.py,sha256=3_EEZop94bMitZaJd2PF5Q2Xt9v94tYg7p7YJz8tAFc,15869
|
93
|
-
airbyte_cdk/sources/declarative/incremental/per_partition_cursor.py,sha256=
|
93
|
+
airbyte_cdk/sources/declarative/incremental/per_partition_cursor.py,sha256=_FSJjAwL4Zu-i2CngnhTtx8j-NPVSBKj5LwDSPta3Cg,16305
|
94
94
|
airbyte_cdk/sources/declarative/incremental/per_partition_with_global.py,sha256=2YBOA2NnwAeIKlIhSwUB_W-FaGnPcmrG_liY7b4mV2Y,8365
|
95
95
|
airbyte_cdk/sources/declarative/incremental/resumable_full_refresh_cursor.py,sha256=10LFv1QPM-agVKl6eaANmEBOfd7gZgBrkoTcMggsieQ,4809
|
96
96
|
airbyte_cdk/sources/declarative/interpolation/__init__.py,sha256=tjUJkn3B-iZ-p7RP2c3dVZejrGiQeooGmS5ibWTuUL4,437
|
@@ -257,7 +257,7 @@ airbyte_cdk/sources/streams/concurrent/abstract_stream.py,sha256=3OB5VsvOkJmCxIM
|
|
257
257
|
airbyte_cdk/sources/streams/concurrent/abstract_stream_facade.py,sha256=QTry1QCBUwJDw1QSCEvz23s7zIEx_7QMxkPq9j-oPIQ,1358
|
258
258
|
airbyte_cdk/sources/streams/concurrent/adapters.py,sha256=QP_64kQo-b3sRNHZA5aqrgCJqAhIVegRM3vJ8jGyuSY,15213
|
259
259
|
airbyte_cdk/sources/streams/concurrent/availability_strategy.py,sha256=4La5v2UffSjGnhmF4kwNIKt_g3RXk2ux1mSHA1ejgYM,2898
|
260
|
-
airbyte_cdk/sources/streams/concurrent/cursor.py,sha256=
|
260
|
+
airbyte_cdk/sources/streams/concurrent/cursor.py,sha256=suObbNi24so8Wcj0Wm32OkJAcuvODAOwp373YBmUPp0,21213
|
261
261
|
airbyte_cdk/sources/streams/concurrent/default_stream.py,sha256=K3rLMpYhS7nnmvwQ52lqBy7DQdFMJpvvT7sgBg_ckA8,3207
|
262
262
|
airbyte_cdk/sources/streams/concurrent/exceptions.py,sha256=JOZ446MCLpmF26r9KfS6OO_6rGjcjgJNZdcw6jccjEI,468
|
263
263
|
airbyte_cdk/sources/streams/concurrent/helpers.py,sha256=S6AW8TgIASCZ2UuUcQLE8OzgYUHWt2-KPOvNPwnQf-Q,1596
|
@@ -343,8 +343,8 @@ airbyte_cdk/utils/slice_hasher.py,sha256=-pHexlNYoWYPnXNH-M7HEbjmeJe9Zk7SJijdQ7d
|
|
343
343
|
airbyte_cdk/utils/spec_schema_transformations.py,sha256=-5HTuNsnDBAhj-oLeQXwpTGA0HdcjFOf2zTEMUTTg_Y,816
|
344
344
|
airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
|
345
345
|
airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
|
346
|
-
airbyte_cdk-6.17.1.
|
347
|
-
airbyte_cdk-6.17.1.
|
348
|
-
airbyte_cdk-6.17.1.
|
349
|
-
airbyte_cdk-6.17.1.
|
350
|
-
airbyte_cdk-6.17.1.
|
346
|
+
airbyte_cdk-6.17.1.dev1.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
|
347
|
+
airbyte_cdk-6.17.1.dev1.dist-info/METADATA,sha256=8TVLQbLq6-v0qkRHb8X4P9x2sYTe9EUjwdvMb2NVOpA,6005
|
348
|
+
airbyte_cdk-6.17.1.dev1.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
349
|
+
airbyte_cdk-6.17.1.dev1.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
|
350
|
+
airbyte_cdk-6.17.1.dev1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|