airbyte-cdk 6.7.3.dev4__py3-none-any.whl → 6.8.0rc1__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.
@@ -205,6 +205,13 @@ class ConcurrentDeclarativeSource(ManifestDeclarativeSource, Generic[TState]):
205
205
  declarative_stream.name
206
206
  ].get("incremental_sync")
207
207
 
208
+ is_without_partition_router_or_cursor = not bool(
209
+ incremental_sync_component_definition
210
+ ) and not (
211
+ name_to_stream_mapping[declarative_stream.name]
212
+ .get("retriever", {})
213
+ .get("partition_router")
214
+ )
208
215
  partition_router_component_definition = (
209
216
  name_to_stream_mapping[declarative_stream.name]
210
217
  .get("retriever")
@@ -216,30 +223,21 @@ class ConcurrentDeclarativeSource(ManifestDeclarativeSource, Generic[TState]):
216
223
  and not incremental_sync_component_definition
217
224
  )
218
225
 
219
- if (
220
- incremental_sync_component_definition
221
- and incremental_sync_component_definition.get("type", "")
222
- == DatetimeBasedCursorModel.__name__
223
- and self._stream_supports_concurrent_partition_processing(
224
- declarative_stream=declarative_stream
225
- )
226
- and hasattr(declarative_stream.retriever, "stream_slicer")
227
- and isinstance(declarative_stream.retriever.stream_slicer, DatetimeBasedCursor)
226
+ if self._is_datetime_incremental_without_partition_routing(
227
+ declarative_stream, incremental_sync_component_definition
228
228
  ):
229
229
  stream_state = state_manager.get_stream_state(
230
230
  stream_name=declarative_stream.name, namespace=declarative_stream.namespace
231
231
  )
232
232
 
233
- cursor, connector_state_converter = (
234
- self._constructor.create_concurrent_cursor_from_datetime_based_cursor(
235
- state_manager=state_manager,
236
- model_type=DatetimeBasedCursorModel,
237
- component_definition=incremental_sync_component_definition,
238
- stream_name=declarative_stream.name,
239
- stream_namespace=declarative_stream.namespace,
240
- config=config or {},
241
- stream_state=stream_state,
242
- )
233
+ cursor = self._constructor.create_concurrent_cursor_from_datetime_based_cursor(
234
+ state_manager=state_manager,
235
+ model_type=DatetimeBasedCursorModel,
236
+ component_definition=incremental_sync_component_definition,
237
+ stream_name=declarative_stream.name,
238
+ stream_namespace=declarative_stream.namespace,
239
+ config=config or {},
240
+ stream_state=stream_state,
243
241
  )
244
242
 
245
243
  partition_generator = StreamSlicerPartitionGenerator(
@@ -263,14 +261,20 @@ class ConcurrentDeclarativeSource(ManifestDeclarativeSource, Generic[TState]):
263
261
  json_schema=declarative_stream.get_json_schema(),
264
262
  availability_strategy=AlwaysAvailableAvailabilityStrategy(),
265
263
  primary_key=get_primary_key_from_stream(declarative_stream.primary_key),
266
- cursor_field=cursor.cursor_field.cursor_field_key,
264
+ cursor_field=cursor.cursor_field.cursor_field_key
265
+ if hasattr(cursor, "cursor_field")
266
+ and hasattr(
267
+ cursor.cursor_field, "cursor_field_key"
268
+ ) # FIXME this will need to be updated once we do the per partition
269
+ else None,
267
270
  logger=self.logger,
268
271
  cursor=cursor,
269
272
  )
270
273
  )
271
- elif is_substream_without_incremental and hasattr(
272
- declarative_stream.retriever, "stream_slicer"
273
- ):
274
+ elif (
275
+ is_substream_without_incremental
276
+ and hasattr(declarative_stream.retriever, "stream_slicer")
277
+ ) or is_without_partition_router_or_cursor:
274
278
  partition_generator = StreamSlicerPartitionGenerator(
275
279
  DeclarativePartitionFactory(
276
280
  declarative_stream.name,
@@ -310,6 +314,20 @@ class ConcurrentDeclarativeSource(ManifestDeclarativeSource, Generic[TState]):
310
314
 
311
315
  return concurrent_streams, synchronous_streams
312
316
 
317
+ def _is_datetime_incremental_without_partition_routing(
318
+ self, declarative_stream, incremental_sync_component_definition
319
+ ):
320
+ return (
321
+ incremental_sync_component_definition
322
+ and incremental_sync_component_definition.get("type", "")
323
+ == DatetimeBasedCursorModel.__name__
324
+ and self._stream_supports_concurrent_partition_processing(
325
+ declarative_stream=declarative_stream
326
+ )
327
+ and hasattr(declarative_stream.retriever, "stream_slicer")
328
+ and isinstance(declarative_stream.retriever.stream_slicer, DatetimeBasedCursor)
329
+ )
330
+
313
331
  def _stream_supports_concurrent_partition_processing(
314
332
  self, declarative_stream: DeclarativeStream
315
333
  ) -> bool:
@@ -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,
@@ -760,7 +759,7 @@ class ModelToComponentFactory:
760
759
  config: Config,
761
760
  stream_state: MutableMapping[str, Any],
762
761
  **kwargs: Any,
763
- ) -> Tuple[ConcurrentCursor, DateTimeStreamStateConverter]:
762
+ ) -> ConcurrentCursor:
764
763
  component_type = component_definition.get("type")
765
764
  if component_definition.get("type") != model_type.__name__:
766
765
  raise ValueError(
@@ -891,23 +890,20 @@ class ModelToComponentFactory:
891
890
  if evaluated_step:
892
891
  step_length = parse_duration(evaluated_step)
893
892
 
894
- return (
895
- ConcurrentCursor(
896
- stream_name=stream_name,
897
- stream_namespace=stream_namespace,
898
- stream_state=stream_state,
899
- message_repository=self._message_repository, # type: ignore # message_repository is always instantiated with a value by factory
900
- connector_state_manager=state_manager,
901
- connector_state_converter=connector_state_converter,
902
- cursor_field=cursor_field,
903
- slice_boundary_fields=slice_boundary_fields,
904
- start=start_date, # type: ignore # Having issues w/ inspection for GapType and CursorValueType as shown in existing tests. Confirmed functionality is working in practice
905
- 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
906
- lookback_window=lookback_window,
907
- slice_range=step_length,
908
- cursor_granularity=cursor_granularity,
909
- ),
910
- connector_state_converter,
893
+ return ConcurrentCursor(
894
+ stream_name=stream_name,
895
+ stream_namespace=stream_namespace,
896
+ stream_state=stream_state,
897
+ message_repository=self._message_repository, # type: ignore # message_repository is always instantiated with a value by factory
898
+ connector_state_manager=state_manager,
899
+ connector_state_converter=connector_state_converter,
900
+ cursor_field=cursor_field,
901
+ slice_boundary_fields=slice_boundary_fields,
902
+ start=start_date, # type: ignore # Having issues w/ inspection for GapType and CursorValueType as shown in existing tests. Confirmed functionality is working in practice
903
+ 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
904
+ lookback_window=lookback_window,
905
+ slice_range=step_length,
906
+ cursor_granularity=cursor_granularity,
911
907
  )
912
908
 
913
909
  @staticmethod
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: airbyte-cdk
3
- Version: 6.7.3.dev4
3
+ Version: 6.8.0rc1
4
4
  Summary: A framework for writing Airbyte Connectors.
5
5
  Home-page: https://airbyte.com
6
6
  License: MIT
@@ -62,7 +62,7 @@ airbyte_cdk/sources/declarative/checks/check_stream.py,sha256=dAA-UhmMj0WLXCkRQr
62
62
  airbyte_cdk/sources/declarative/checks/connection_checker.py,sha256=MBRJo6WJlZQHpIfOGaNOkkHUmgUl_4wDM6VPo41z5Ss,1383
63
63
  airbyte_cdk/sources/declarative/concurrency_level/__init__.py,sha256=5XUqrmlstYlMM0j6crktlKQwALek0uiz2D3WdM46MyA,191
64
64
  airbyte_cdk/sources/declarative/concurrency_level/concurrency_level.py,sha256=YIwCTCpOr_QSNW4ltQK0yUGWInI8PKNY216HOOegYLk,2101
65
- airbyte_cdk/sources/declarative/concurrent_declarative_source.py,sha256=k2rHM3FIyoRUCZ7egwO36gd9fyX_J1ZokfAtpVzNvac,22641
65
+ airbyte_cdk/sources/declarative/concurrent_declarative_source.py,sha256=dQs_GovwXc_EPBjUZ4fpZFkGklpFuoq_qFmAFFtIz-g,23469
66
66
  airbyte_cdk/sources/declarative/datetime/__init__.py,sha256=l9LG7Qm6e5r_qgqfVKnx3mXYtg1I9MmMjomVIPfU4XA,177
67
67
  airbyte_cdk/sources/declarative/datetime/datetime_parser.py,sha256=SX9JjdesN1edN2WVUVMzU_ptqp2QB1OnsnjZ4mwcX7w,2579
68
68
  airbyte_cdk/sources/declarative/datetime/min_max_datetime.py,sha256=8VZJP18eJLabSPP1XBSPDaagUBG6q1ynIiPJy3rE2mc,5344
@@ -109,7 +109,7 @@ airbyte_cdk/sources/declarative/parsers/__init__.py,sha256=ZnqYNxHsKCgO38IwB34RQ
109
109
  airbyte_cdk/sources/declarative/parsers/custom_exceptions.py,sha256=Rir9_z3Kcd5Es0-LChrzk-0qubAsiK_RSEnLmK2OXm8,553
110
110
  airbyte_cdk/sources/declarative/parsers/manifest_component_transformer.py,sha256=jVZ3ZV5YZrmDNIX5cM2mugXmnbH27zHRcD22_3oatpo,8454
111
111
  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=-1J_fjk3XQB42ApcpJEZmu5EqHiGmw5e1i42iGVmCWI,96909
112
+ airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=dvTPT7v_BlLZTLTPV6Uf9B5A5PnJ4mUgUeaxLzoMJBg,96741
113
113
  airbyte_cdk/sources/declarative/partition_routers/__init__.py,sha256=8uGos2u7TFTx_EJBdcjdUGn3Eyx6jUuEa1_VB8UP_dI,631
114
114
  airbyte_cdk/sources/declarative/partition_routers/cartesian_product_stream_slicer.py,sha256=c5cuVFM6NFkuQqG8Z5IwkBuwDrvXZN1CunUOM_L0ezg,6892
115
115
  airbyte_cdk/sources/declarative/partition_routers/list_partition_router.py,sha256=t7pRdFWfFWJtQQG19c9PVeMODyO2BknRTakpM5U9N-8,4844
@@ -330,8 +330,8 @@ airbyte_cdk/utils/slice_hasher.py,sha256=-pHexlNYoWYPnXNH-M7HEbjmeJe9Zk7SJijdQ7d
330
330
  airbyte_cdk/utils/spec_schema_transformations.py,sha256=LVc9KbtMeV_z99jWo0Ou8u4l6eBJ0BWNhxj4zrrGKRs,763
331
331
  airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
332
332
  airbyte_cdk/utils/traced_exception.py,sha256=a6q51tBS3IdtefuOiL1eBwSmnNAXfjFMlMjSIQ_Tl-o,6165
333
- airbyte_cdk-6.7.3.dev4.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
334
- airbyte_cdk-6.7.3.dev4.dist-info/METADATA,sha256=-I71-9_d4qtvkkHxIr6C9k04H-u7ULAWQoG_ugKLK_U,13524
335
- airbyte_cdk-6.7.3.dev4.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
336
- airbyte_cdk-6.7.3.dev4.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
337
- airbyte_cdk-6.7.3.dev4.dist-info/RECORD,,
333
+ airbyte_cdk-6.8.0rc1.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
334
+ airbyte_cdk-6.8.0rc1.dist-info/METADATA,sha256=YOrRK51OQ_qmAsYmGE-8vdPkI7AnjIa6srLberRWNBU,13522
335
+ airbyte_cdk-6.8.0rc1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
336
+ airbyte_cdk-6.8.0rc1.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
337
+ airbyte_cdk-6.8.0rc1.dist-info/RECORD,,