airbyte-cdk 6.6.8rc1__py3-none-any.whl → 6.6.8rc12__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.
@@ -24,6 +24,8 @@ from airbyte_cdk.sources.declarative.interpolation import InterpolatedString
24
24
  from airbyte_cdk.sources.declarative.manifest_declarative_source import ManifestDeclarativeSource
25
25
  from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
26
26
  ConcurrencyLevel as ConcurrencyLevelModel,
27
+ )
28
+ from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
27
29
  DatetimeBasedCursor as DatetimeBasedCursorModel,
28
30
  DeclarativeStream as DeclarativeStreamModel,
29
31
  )
@@ -46,7 +48,6 @@ from airbyte_cdk.sources.streams.concurrent.abstract_stream import AbstractStrea
46
48
  from airbyte_cdk.sources.streams.concurrent.availability_strategy import (
47
49
  AlwaysAvailableAvailabilityStrategy,
48
50
  )
49
- from airbyte_cdk.sources.streams.concurrent.cursor import FinalStateCursor
50
51
  from airbyte_cdk.sources.streams.concurrent.default_stream import DefaultStream
51
52
  from airbyte_cdk.sources.streams.concurrent.helpers import get_primary_key_from_stream
52
53
 
@@ -66,15 +67,6 @@ class ConcurrentDeclarativeSource(ManifestDeclarativeSource, Generic[TState]):
66
67
  component_factory: Optional[ModelToComponentFactory] = None,
67
68
  **kwargs: Any,
68
69
  ) -> None:
69
- # To reduce the complexity of the concurrent framework, we are not enabling RFR with synthetic
70
- # cursors. We do this by no longer automatically instantiating RFR cursors when converting
71
- # the declarative models into runtime components. Concurrent sources will continue to checkpoint
72
- # incremental streams running in full refresh.
73
- component_factory = component_factory or ModelToComponentFactory(
74
- emit_connector_builder_messages=emit_connector_builder_messages,
75
- disable_resumable_full_refresh=True,
76
- )
77
-
78
70
  super().__init__(
79
71
  source_config=source_config,
80
72
  debug=debug,
@@ -201,17 +193,6 @@ class ConcurrentDeclarativeSource(ManifestDeclarativeSource, Generic[TState]):
201
193
  declarative_stream.name
202
194
  ].get("incremental_sync")
203
195
 
204
- partition_router_component_definition = (
205
- name_to_stream_mapping[declarative_stream.name]
206
- .get("retriever")
207
- .get("partition_router")
208
- )
209
-
210
- is_substream_without_incremental = (
211
- partition_router_component_definition
212
- and not datetime_based_cursor_component_definition
213
- )
214
-
215
196
  if (
216
197
  datetime_based_cursor_component_definition
217
198
  and datetime_based_cursor_component_definition.get("type", "")
@@ -264,41 +245,6 @@ class ConcurrentDeclarativeSource(ManifestDeclarativeSource, Generic[TState]):
264
245
  cursor=cursor,
265
246
  )
266
247
  )
267
- elif is_substream_without_incremental and hasattr(
268
- declarative_stream.retriever, "stream_slicer"
269
- ):
270
- partition_generator = StreamSlicerPartitionGenerator(
271
- DeclarativePartitionFactory(
272
- declarative_stream.name,
273
- declarative_stream.get_json_schema(),
274
- self._retriever_factory(
275
- name_to_stream_mapping[declarative_stream.name],
276
- config,
277
- {},
278
- ),
279
- self.message_repository,
280
- ),
281
- declarative_stream.retriever.stream_slicer,
282
- )
283
-
284
- cursor = FinalStateCursor(
285
- stream_name=declarative_stream.name,
286
- stream_namespace=declarative_stream.namespace,
287
- message_repository=self.message_repository,
288
- )
289
-
290
- concurrent_streams.append(
291
- DefaultStream(
292
- partition_generator=partition_generator,
293
- name=declarative_stream.name,
294
- json_schema=declarative_stream.get_json_schema(),
295
- availability_strategy=AlwaysAvailableAvailabilityStrategy(),
296
- primary_key=get_primary_key_from_stream(declarative_stream.primary_key),
297
- cursor_field=None,
298
- logger=self.logger,
299
- cursor=cursor,
300
- )
301
- )
302
248
  else:
303
249
  synchronous_streams.append(declarative_stream)
304
250
  else:
@@ -383,7 +383,6 @@ class ModelToComponentFactory:
383
383
  emit_connector_builder_messages: bool = False,
384
384
  disable_retries: bool = False,
385
385
  disable_cache: bool = False,
386
- disable_resumable_full_refresh: bool = False,
387
386
  message_repository: Optional[MessageRepository] = None,
388
387
  ):
389
388
  self._init_mappings()
@@ -392,7 +391,6 @@ class ModelToComponentFactory:
392
391
  self._emit_connector_builder_messages = emit_connector_builder_messages
393
392
  self._disable_retries = disable_retries
394
393
  self._disable_cache = disable_cache
395
- self._disable_resumable_full_refresh = disable_resumable_full_refresh
396
394
  self._message_repository = message_repository or InMemoryMessageRepository( # type: ignore
397
395
  self._evaluate_log_level(emit_connector_builder_messages)
398
396
  )
@@ -1336,8 +1334,6 @@ class ModelToComponentFactory:
1336
1334
  if model.incremental_sync
1337
1335
  else None
1338
1336
  )
1339
- elif self._disable_resumable_full_refresh:
1340
- return stream_slicer
1341
1337
  elif stream_slicer:
1342
1338
  # For the Full-Refresh sub-streams, we use the nested `ChildPartitionResumableFullRefreshCursor`
1343
1339
  return PerPartitionCursor(
@@ -1,7 +1,6 @@
1
1
  #
2
2
  # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
3
3
  #
4
-
5
4
  import logging
6
5
  import os
7
6
  import urllib
@@ -43,6 +42,7 @@ from airbyte_cdk.sources.streams.http.rate_limiting import (
43
42
  rate_limit_default_backoff_handler,
44
43
  user_defined_backoff_handler,
45
44
  )
45
+ from airbyte_cdk.utils.airbyte_secrets_utils import filter_secrets
46
46
  from airbyte_cdk.utils.constants import ENV_REQUEST_CACHE_PATH
47
47
  from airbyte_cdk.utils.stream_status_utils import (
48
48
  as_airbyte_message as stream_status_as_airbyte_message,
@@ -73,6 +73,7 @@ class MessageRepresentationAirbyteTracedErrors(AirbyteTracedException):
73
73
  class HttpClient:
74
74
  _DEFAULT_MAX_RETRY: int = 5
75
75
  _DEFAULT_MAX_TIME: int = 60 * 10
76
+ _ACTIONS_TO_RETRY_ON = {ResponseAction.RETRY, ResponseAction.RATE_LIMITED}
76
77
 
77
78
  def __init__(
78
79
  self,
@@ -333,6 +334,17 @@ class HttpClient:
333
334
 
334
335
  return response # type: ignore # will either return a valid response of type requests.Response or raise an exception
335
336
 
337
+ def _evict_key(self, prepared_request: requests.PreparedRequest) -> None:
338
+ """
339
+ Addresses high memory consumption when enabling concurrency in https://github.com/airbytehq/oncall/issues/6821.
340
+
341
+ The `_request_attempt_count` attribute keeps growing as multiple requests are made using the same `http_client`.
342
+ To mitigate this issue, we evict keys for completed requests once we confirm that no further retries are needed.
343
+ This helps manage memory usage more efficiently while maintaining the necessary logic for retry attempts.
344
+ """
345
+ if prepared_request in self._request_attempt_count:
346
+ del self._request_attempt_count[prepared_request]
347
+
336
348
  def _handle_error_resolution(
337
349
  self,
338
350
  response: Optional[requests.Response],
@@ -341,6 +353,9 @@ class HttpClient:
341
353
  error_resolution: ErrorResolution,
342
354
  exit_on_rate_limit: Optional[bool] = False,
343
355
  ) -> None:
356
+ if error_resolution.response_action not in self._ACTIONS_TO_RETRY_ON:
357
+ self._evict_key(request)
358
+
344
359
  # Emit stream status RUNNING with the reason RATE_LIMITED to log that the rate limit has been reached
345
360
  if error_resolution.response_action == ResponseAction.RATE_LIMITED:
346
361
  # TODO: Update to handle with message repository when concurrent message repository is ready
@@ -361,12 +376,13 @@ class HttpClient:
361
376
 
362
377
  if error_resolution.response_action == ResponseAction.FAIL:
363
378
  if response is not None:
364
- error_message = f"'{request.method}' request to '{request.url}' failed with status code '{response.status_code}' and error message '{self._error_message_parser.parse_response_error_message(response)}'"
379
+ error_message = f"'{request.method}' request to '{request.url}' failed with status code '{response.status_code}' and error message '{response.content}'"
365
380
  else:
366
381
  error_message = (
367
382
  f"'{request.method}' request to '{request.url}' failed with exception: '{exc}'"
368
383
  )
369
384
 
385
+ self._logger.warning(filter_secrets(error_message))
370
386
  raise MessageRepresentationAirbyteTracedErrors(
371
387
  internal_message=error_message,
372
388
  message=error_resolution.error_message or error_message,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: airbyte-cdk
3
- Version: 6.6.8rc1
3
+ Version: 6.6.8rc12
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=C3T-xJYl8SmaxXhMTVTK4gkuDznpOfkAkMYorexSIGg,22474
65
+ airbyte_cdk/sources/declarative/concurrent_declarative_source.py,sha256=BpaTXzdf57pqUg1xDlj2xxm-VN74h8c-55xEQUlA_1I,19734
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=WybQH-a4JACXk2L0Z5quylo-dmrEkDH7zfFEtN4O688,95619
112
+ airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=ObmWWZBE1jeP63_B74GaZqLlHmNsShBp6kOIF4hXXCI,95403
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
@@ -274,7 +274,7 @@ airbyte_cdk/sources/streams/http/error_handlers/json_error_message_parser.py,sha
274
274
  airbyte_cdk/sources/streams/http/error_handlers/response_models.py,sha256=7AX6sm8hMfVtcZuUrCmGmNFsO5rDK9Ecg2Kzl6rQwrk,2235
275
275
  airbyte_cdk/sources/streams/http/exceptions.py,sha256=njC7MlMJoFYcSGz4mIp6-bqLFTr6vC8ej25X0oSeyjE,1824
276
276
  airbyte_cdk/sources/streams/http/http.py,sha256=XoUvIClYO96datz_lBPBBY6uWmCja2mUk_yERdjskQo,28466
277
- airbyte_cdk/sources/streams/http/http_client.py,sha256=EhB9An8wA9wkoNBxTPfHGwmL_-jJVLUl6uFgkY6Fcho,19125
277
+ airbyte_cdk/sources/streams/http/http_client.py,sha256=vFSoGF6_6Xz210P3PASBs2ggNVgThdLsSAclE1LzP_k,20103
278
278
  airbyte_cdk/sources/streams/http/rate_limiting.py,sha256=IwdjrHKUnU97XO4qONgYRv4YYW51xQ8SJm4WLafXDB8,6351
279
279
  airbyte_cdk/sources/streams/http/requests_native_auth/__init__.py,sha256=RN0D3nOX1xLgwEwKWu6pkGy3XqBFzKSNZ8Lf6umU2eY,413
280
280
  airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py,sha256=r6KvG6V-bzhnCGwLqnxngrjGM0UrvD1dRo8knatuAH0,10320
@@ -331,8 +331,8 @@ airbyte_cdk/utils/slice_hasher.py,sha256=EemcgcQlI8-LPYOPlYv4Qkdjyho79XVLWaUHF5X
331
331
  airbyte_cdk/utils/spec_schema_transformations.py,sha256=LVc9KbtMeV_z99jWo0Ou8u4l6eBJ0BWNhxj4zrrGKRs,763
332
332
  airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
333
333
  airbyte_cdk/utils/traced_exception.py,sha256=89TQdFuYZ1NJgmFpqLzY_T_T_64TpJYmVqs119Bp43g,6164
334
- airbyte_cdk-6.6.8rc1.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
335
- airbyte_cdk-6.6.8rc1.dist-info/METADATA,sha256=h38nyc2RT2vrfngti0tfVCJWo-GpgsuXH_FUlLahfGI,13345
336
- airbyte_cdk-6.6.8rc1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
337
- airbyte_cdk-6.6.8rc1.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
338
- airbyte_cdk-6.6.8rc1.dist-info/RECORD,,
334
+ airbyte_cdk-6.6.8rc12.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
335
+ airbyte_cdk-6.6.8rc12.dist-info/METADATA,sha256=zii2yqop4Sen_rkbdozR-ppoaIS4SyKjOsU9ucRiyEA,13346
336
+ airbyte_cdk-6.6.8rc12.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
337
+ airbyte_cdk-6.6.8rc12.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
338
+ airbyte_cdk-6.6.8rc12.dist-info/RECORD,,