airbyte-cdk 7.3.1__py3-none-any.whl → 7.3.2__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.
@@ -2208,6 +2208,14 @@ class ModelToComponentFactory:
2208
2208
  and stream_slicer
2209
2209
  and not isinstance(stream_slicer, SinglePartitionRouter)
2210
2210
  ):
2211
+ if isinstance(model.incremental_sync, IncrementingCountCursorModel):
2212
+ # We don't currently support usage of partition routing and IncrementingCountCursor at the
2213
+ # same time because we didn't solve for design questions like what the lookback window would
2214
+ # be as well as global cursor fall backs. We have not seen customers that have needed both
2215
+ # at the same time yet and are currently punting on this until we need to solve it.
2216
+ raise ValueError(
2217
+ f"The low-code framework does not currently support usage of a PartitionRouter and an IncrementingCountCursor at the same time. Please specify only one of these options for stream {stream_name}."
2218
+ )
2211
2219
  return self.create_concurrent_cursor_from_perpartition_cursor( # type: ignore # This is a known issue that we are creating and returning a ConcurrentCursor which does not technically implement the (low-code) StreamSlicer. However, (low-code) StreamSlicer and ConcurrentCursor both implement StreamSlicer.stream_slices() which is the primary method needed for checkpointing
2212
2220
  state_manager=self._connector_state_manager,
2213
2221
  model_type=DatetimeBasedCursorModel,
@@ -2395,21 +2403,12 @@ class ModelToComponentFactory:
2395
2403
 
2396
2404
  api_budget = self._api_budget
2397
2405
 
2398
- # Removes QueryProperties components from the interpolated mappings because it has been designed
2399
- # to be used by the SimpleRetriever and will be resolved from the provider from the slice directly
2400
- # instead of through jinja interpolation
2401
- request_parameters: Optional[Union[str, Mapping[str, str]]]
2402
- if isinstance(model.request_parameters, Mapping):
2403
- request_parameters = self._remove_query_properties(model.request_parameters)
2404
- else:
2405
- request_parameters = model.request_parameters
2406
-
2407
2406
  request_options_provider = InterpolatedRequestOptionsProvider(
2408
2407
  request_body=model.request_body,
2409
2408
  request_body_data=model.request_body_data,
2410
2409
  request_body_json=model.request_body_json,
2411
2410
  request_headers=model.request_headers,
2412
- request_parameters=request_parameters,
2411
+ request_parameters=model.request_parameters, # type: ignore # QueryProperties have been removed in `create_simple_retriever`
2413
2412
  query_properties_key=query_properties_key,
2414
2413
  config=config,
2415
2414
  parameters=model.parameters or {},
@@ -3199,7 +3198,8 @@ class ModelToComponentFactory:
3199
3198
 
3200
3199
  query_properties: Optional[QueryProperties] = None
3201
3200
  query_properties_key: Optional[str] = None
3202
- if self._query_properties_in_request_parameters(model.requester):
3201
+ self._ensure_query_properties_to_model(model.requester)
3202
+ if self._has_query_properties_in_request_parameters(model.requester):
3203
3203
  # It is better to be explicit about an error if PropertiesFromEndpoint is defined in multiple
3204
3204
  # places instead of default to request_parameters which isn't clearly documented
3205
3205
  if (
@@ -3211,7 +3211,7 @@ class ModelToComponentFactory:
3211
3211
  )
3212
3212
 
3213
3213
  query_properties_definitions = []
3214
- for key, request_parameter in model.requester.request_parameters.items(): # type: ignore # request_parameters is already validated to be a Mapping using _query_properties_in_request_parameters()
3214
+ for key, request_parameter in model.requester.request_parameters.items(): # type: ignore # request_parameters is already validated to be a Mapping using _has_query_properties_in_request_parameters()
3215
3215
  if isinstance(request_parameter, QueryPropertiesModel):
3216
3216
  query_properties_key = key
3217
3217
  query_properties_definitions.append(request_parameter)
@@ -3225,6 +3225,16 @@ class ModelToComponentFactory:
3225
3225
  query_properties = self._create_component_from_model(
3226
3226
  model=query_properties_definitions[0], config=config
3227
3227
  )
3228
+
3229
+ # Removes QueryProperties components from the interpolated mappings because it has been designed
3230
+ # to be used by the SimpleRetriever and will be resolved from the provider from the slice directly
3231
+ # instead of through jinja interpolation
3232
+ if hasattr(model.requester, "request_parameters") and isinstance(
3233
+ model.requester.request_parameters, Mapping
3234
+ ):
3235
+ model.requester.request_parameters = self._remove_query_properties(
3236
+ model.requester.request_parameters
3237
+ )
3228
3238
  elif (
3229
3239
  hasattr(model.requester, "fetch_properties_from_endpoint")
3230
3240
  and model.requester.fetch_properties_from_endpoint
@@ -3361,7 +3371,7 @@ class ModelToComponentFactory:
3361
3371
  return bool(self._limit_slices_fetched or self._emit_connector_builder_messages)
3362
3372
 
3363
3373
  @staticmethod
3364
- def _query_properties_in_request_parameters(
3374
+ def _has_query_properties_in_request_parameters(
3365
3375
  requester: Union[HttpRequesterModel, CustomRequesterModel],
3366
3376
  ) -> bool:
3367
3377
  if not hasattr(requester, "request_parameters"):
@@ -4175,3 +4185,26 @@ class ModelToComponentFactory:
4175
4185
  deduplicate=model.deduplicate if model.deduplicate is not None else True,
4176
4186
  config=config,
4177
4187
  )
4188
+
4189
+ def _ensure_query_properties_to_model(
4190
+ self, requester: Union[HttpRequesterModel, CustomRequesterModel]
4191
+ ) -> None:
4192
+ """
4193
+ For some reason, it seems like CustomRequesterModel request_parameters stays as dictionaries which means that
4194
+ the other conditions relying on it being QueryPropertiesModel instead of a dict fail. Here, we migrate them to
4195
+ proper model.
4196
+ """
4197
+ if not hasattr(requester, "request_parameters"):
4198
+ return
4199
+
4200
+ request_parameters = requester.request_parameters
4201
+ if request_parameters and isinstance(request_parameters, Dict):
4202
+ for request_parameter_key in request_parameters.keys():
4203
+ request_parameter = request_parameters[request_parameter_key]
4204
+ if (
4205
+ isinstance(request_parameter, Dict)
4206
+ and request_parameter.get("type") == "QueryProperties"
4207
+ ):
4208
+ request_parameters[request_parameter_key] = QueryPropertiesModel.parse_obj(
4209
+ request_parameter
4210
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: airbyte-cdk
3
- Version: 7.3.1
3
+ Version: 7.3.2
4
4
  Summary: A framework for writing Airbyte Connectors.
5
5
  Home-page: https://airbyte.com
6
6
  License: MIT
@@ -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=lMjcNJKqU3HcOjNZyR4_Ln1v32HK-7iNcFq4nmFjxSE,183622
175
+ airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=QUDfBVn3KQZQKQJUyr4Dfzez4742JEtat3VuwStsTHM,185692
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.3.1.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
461
- airbyte_cdk-7.3.1.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
462
- airbyte_cdk-7.3.1.dist-info/METADATA,sha256=_n29oKSyO6A6mUMN1c6YqHvrJRFQrXOIhhAh1E0PuXo,6798
463
- airbyte_cdk-7.3.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
464
- airbyte_cdk-7.3.1.dist-info/entry_points.txt,sha256=eLZ2UYvJZGm1s07Pplcs--1Gim60YhZWTb53j_dghwU,195
465
- airbyte_cdk-7.3.1.dist-info/RECORD,,
460
+ airbyte_cdk-7.3.2.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
461
+ airbyte_cdk-7.3.2.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
462
+ airbyte_cdk-7.3.2.dist-info/METADATA,sha256=rx2PHndj9YB3wb4wbgEplFCj7zyt3Lge0QkB5ztsRHQ,6798
463
+ airbyte_cdk-7.3.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
464
+ airbyte_cdk-7.3.2.dist-info/entry_points.txt,sha256=eLZ2UYvJZGm1s07Pplcs--1Gim60YhZWTb53j_dghwU,195
465
+ airbyte_cdk-7.3.2.dist-info/RECORD,,