airbyte-cdk 7.0.1__py3-none-any.whl → 7.0.3__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.
@@ -189,6 +189,7 @@ class ConcurrentPerPartitionCursor(Cursor):
189
189
  # FIXME this is a temporary field the time of the migration from declarative cursors to concurrent ones
190
190
  self._attempt_to_create_cursor_if_not_provided = attempt_to_create_cursor_if_not_provided
191
191
  self._synced_some_data = False
192
+ self._logged_regarding_datetime_format_error = False
192
193
 
193
194
  @property
194
195
  def cursor_field(self) -> CursorField:
@@ -518,10 +519,23 @@ class ConcurrentPerPartitionCursor(Cursor):
518
519
  except ValueError:
519
520
  return
520
521
 
522
+ try:
523
+ record_cursor = self._connector_state_converter.output_format(
524
+ self._connector_state_converter.parse_value(record_cursor_value)
525
+ )
526
+ except ValueError as exception:
527
+ if not self._logged_regarding_datetime_format_error:
528
+ logger.warning(
529
+ "Skipping cursor update for stream '%s': failed to parse cursor field '%s' value %r: %s",
530
+ self._stream_name,
531
+ self._cursor_field.cursor_field_key,
532
+ record_cursor_value,
533
+ exception,
534
+ )
535
+ self._logged_regarding_datetime_format_error = True
536
+ return
537
+
521
538
  self._synced_some_data = True
522
- record_cursor = self._connector_state_converter.output_format(
523
- self._connector_state_converter.parse_value(record_cursor_value)
524
- )
525
539
  self._update_global_cursor(record_cursor)
526
540
  if not self._use_global_cursor:
527
541
  self._cursor_per_partition[
@@ -1976,7 +1976,10 @@ class ModelToComponentFactory:
1976
1976
  primary_key = model.primary_key.__root__ if model.primary_key else None
1977
1977
 
1978
1978
  partition_router = self._build_stream_slicer_from_partition_router(
1979
- model.retriever, config, stream_name=model.name
1979
+ model.retriever,
1980
+ config,
1981
+ stream_name=model.name,
1982
+ **kwargs,
1980
1983
  )
1981
1984
  concurrent_cursor = self._build_concurrent_cursor(model, partition_router, config)
1982
1985
  if model.incremental_sync and isinstance(model.incremental_sync, DatetimeBasedCursorModel):
@@ -2155,10 +2158,11 @@ class ModelToComponentFactory:
2155
2158
  ],
2156
2159
  config: Config,
2157
2160
  stream_name: Optional[str] = None,
2161
+ **kwargs: Any,
2158
2162
  ) -> PartitionRouter:
2159
2163
  if (
2160
2164
  hasattr(model, "partition_router")
2161
- and isinstance(model, SimpleRetrieverModel | AsyncRetrieverModel)
2165
+ and isinstance(model, (SimpleRetrieverModel, AsyncRetrieverModel, CustomRetrieverModel))
2162
2166
  and model.partition_router
2163
2167
  ):
2164
2168
  stream_slicer_model = model.partition_router
@@ -2172,6 +2176,23 @@ class ModelToComponentFactory:
2172
2176
  ],
2173
2177
  parameters={},
2174
2178
  )
2179
+ elif isinstance(stream_slicer_model, dict):
2180
+ # partition router comes from CustomRetrieverModel therefore has not been parsed as a model
2181
+ params = stream_slicer_model.get("$parameters")
2182
+ if not isinstance(params, dict):
2183
+ params = {}
2184
+ stream_slicer_model["$parameters"] = params
2185
+
2186
+ if stream_name is not None:
2187
+ params["stream_name"] = stream_name
2188
+
2189
+ return self._create_nested_component( # type: ignore[no-any-return] # There is no guarantee that this will return a stream slicer. If not, we expect an AttributeError during the call to `stream_slices`
2190
+ model,
2191
+ "partition_router",
2192
+ stream_slicer_model,
2193
+ config,
2194
+ **kwargs,
2195
+ )
2175
2196
  else:
2176
2197
  return self._create_component_from_model( # type: ignore[no-any-return] # Will be created PartitionRouter as stream_slicer_model is model.partition_router
2177
2198
  model=stream_slicer_model, config=config, stream_name=stream_name or ""
@@ -2886,7 +2907,7 @@ class ModelToComponentFactory:
2886
2907
  )
2887
2908
 
2888
2909
  def create_parent_stream_config(
2889
- self, model: ParentStreamConfigModel, config: Config, stream_name: str, **kwargs: Any
2910
+ self, model: ParentStreamConfigModel, config: Config, *, stream_name: str, **kwargs: Any
2890
2911
  ) -> ParentStreamConfig:
2891
2912
  declarative_stream = self._create_component_from_model(
2892
2913
  model.stream,
@@ -3693,14 +3714,19 @@ class ModelToComponentFactory:
3693
3714
  )
3694
3715
 
3695
3716
  def create_substream_partition_router(
3696
- self, model: SubstreamPartitionRouterModel, config: Config, **kwargs: Any
3717
+ self,
3718
+ model: SubstreamPartitionRouterModel,
3719
+ config: Config,
3720
+ *,
3721
+ stream_name: str,
3722
+ **kwargs: Any,
3697
3723
  ) -> SubstreamPartitionRouter:
3698
3724
  parent_stream_configs = []
3699
3725
  if model.parent_stream_configs:
3700
3726
  parent_stream_configs.extend(
3701
3727
  [
3702
3728
  self.create_parent_stream_config_with_substream_wrapper(
3703
- model=parent_stream_config, config=config, **kwargs
3729
+ model=parent_stream_config, config=config, stream_name=stream_name, **kwargs
3704
3730
  )
3705
3731
  for parent_stream_config in model.parent_stream_configs
3706
3732
  ]
@@ -3720,7 +3746,7 @@ class ModelToComponentFactory:
3720
3746
 
3721
3747
  # This flag will be used exclusively for StateDelegatingStream when a parent stream is created
3722
3748
  has_parent_state = bool(
3723
- self._connector_state_manager.get_stream_state(kwargs.get("stream_name", ""), None)
3749
+ self._connector_state_manager.get_stream_state(stream_name, None)
3724
3750
  if model.incremental_dependency
3725
3751
  else False
3726
3752
  )
@@ -4113,11 +4139,17 @@ class ModelToComponentFactory:
4113
4139
  )
4114
4140
 
4115
4141
  def create_grouping_partition_router(
4116
- self, model: GroupingPartitionRouterModel, config: Config, **kwargs: Any
4142
+ self,
4143
+ model: GroupingPartitionRouterModel,
4144
+ config: Config,
4145
+ *,
4146
+ stream_name: str,
4147
+ **kwargs: Any,
4117
4148
  ) -> GroupingPartitionRouter:
4118
4149
  underlying_router = self._create_component_from_model(
4119
4150
  model=model.underlying_partition_router,
4120
4151
  config=config,
4152
+ stream_name=stream_name,
4121
4153
  **kwargs,
4122
4154
  )
4123
4155
  if model.group_size < 1:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: airbyte-cdk
3
- Version: 7.0.1
3
+ Version: 7.0.3
4
4
  Summary: A framework for writing Airbyte Connectors.
5
5
  Home-page: https://airbyte.com
6
6
  License: MIT
@@ -150,7 +150,7 @@ airbyte_cdk/sources/declarative/extractors/record_selector.py,sha256=vCpwX1PVRFP
150
150
  airbyte_cdk/sources/declarative/extractors/response_to_file_extractor.py,sha256=WJyA2OYIEgFpVP5Y3o0tIj69AV6IKkn9B16MeXaEItI,6513
151
151
  airbyte_cdk/sources/declarative/extractors/type_transformer.py,sha256=d6Y2Rfg8pMVEEnHllfVksWZdNVOU55yk34O03dP9muY,1626
152
152
  airbyte_cdk/sources/declarative/incremental/__init__.py,sha256=_y8H65KgdmVNpwQAzXtXzi-t9mY6bmIIAWtRAbpHfEo,295
153
- airbyte_cdk/sources/declarative/incremental/concurrent_partition_cursor.py,sha256=b7BFnatvndYx9gUQfUcM6miejnR_VQBqBhtCfa5Of5Q,27261
153
+ airbyte_cdk/sources/declarative/incremental/concurrent_partition_cursor.py,sha256=vaynWCXmScAuVnrbJ2T7M1Y4RSZO7ctAej-kzZJYifk,27868
154
154
  airbyte_cdk/sources/declarative/interpolation/__init__.py,sha256=Kh7FxhfetyNVDnAQ9zSxNe4oUbb8CvoW7Mqz7cs2iPg,437
155
155
  airbyte_cdk/sources/declarative/interpolation/filters.py,sha256=cYap5zzOxIJWCLIfbkNlpyfUhjZ8FklLroIG4WGzYVs,5537
156
156
  airbyte_cdk/sources/declarative/interpolation/interpolated_boolean.py,sha256=8F3ntT_Mfo8cO9n6dCq8rTfJIpfKmzRCsVtVdhzaoGc,1964
@@ -172,7 +172,7 @@ airbyte_cdk/sources/declarative/parsers/custom_exceptions.py,sha256=wnRUP0Xeru9R
172
172
  airbyte_cdk/sources/declarative/parsers/manifest_component_transformer.py,sha256=la9Ulpc0lQewiBLKJ0FpsWxyU5XISv-ulmFRHJLJ1Pc,11292
173
173
  airbyte_cdk/sources/declarative/parsers/manifest_normalizer.py,sha256=EtKjS9c94yNp3AwQC8KUCQaAYW5T3zvFYxoWYjc_buI,19729
174
174
  airbyte_cdk/sources/declarative/parsers/manifest_reference_resolver.py,sha256=pJmg78vqE5VfUrF_KJnWjucQ4k9IWFULeAxHCowrHXE,6806
175
- airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=G1IR4MW9lOlIJyebJzIKzqhM9VI9yi-fUQ-BqooFhCw,183093
175
+ airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=Zu4E2nvPzGyi_EnmbdrUrQ1myUvPQ5GtcWITzksYMcQ,184235
176
176
  airbyte_cdk/sources/declarative/partition_routers/__init__.py,sha256=TBC9AkGaUqHm2IKHMPN6punBIcY5tWGULowcLoAVkfw,1109
177
177
  airbyte_cdk/sources/declarative/partition_routers/async_job_partition_router.py,sha256=VelO7zKqKtzMJ35jyFeg0ypJLQC0plqqIBNXoBW1G2E,3001
178
178
  airbyte_cdk/sources/declarative/partition_routers/cartesian_product_stream_slicer.py,sha256=ocm4hZ4k-tEGs5HLrtI8ecWSK0hGqNH0Rvz2byx_HZk,6927
@@ -457,9 +457,9 @@ airbyte_cdk/utils/slice_hasher.py,sha256=EDxgROHDbfG-QKQb59m7h_7crN1tRiawdf5uU7G
457
457
  airbyte_cdk/utils/spec_schema_transformations.py,sha256=9YDJmnIGFsT51CVQf2tSSvTapGimITjEFGbUTSZAGTI,963
458
458
  airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
459
459
  airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
460
- airbyte_cdk-7.0.1.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
461
- airbyte_cdk-7.0.1.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
462
- airbyte_cdk-7.0.1.dist-info/METADATA,sha256=LciRu8L_L0CU2pib2ROCYVTOslsbH3ocuXDlz4w4KUg,6799
463
- airbyte_cdk-7.0.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
464
- airbyte_cdk-7.0.1.dist-info/entry_points.txt,sha256=eLZ2UYvJZGm1s07Pplcs--1Gim60YhZWTb53j_dghwU,195
465
- airbyte_cdk-7.0.1.dist-info/RECORD,,
460
+ airbyte_cdk-7.0.3.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
461
+ airbyte_cdk-7.0.3.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
462
+ airbyte_cdk-7.0.3.dist-info/METADATA,sha256=H974zlTwTHg5w991ZshrilcgpSUMVvHCTlMcUrMOf6E,6799
463
+ airbyte_cdk-7.0.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
464
+ airbyte_cdk-7.0.3.dist-info/entry_points.txt,sha256=eLZ2UYvJZGm1s07Pplcs--1Gim60YhZWTb53j_dghwU,195
465
+ airbyte_cdk-7.0.3.dist-info/RECORD,,