airbyte-cdk 6.8.0__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.
airbyte_cdk/entrypoint.py CHANGED
@@ -15,8 +15,8 @@ from functools import wraps
15
15
  from typing import Any, DefaultDict, Iterable, List, Mapping, Optional
16
16
  from urllib.parse import urlparse
17
17
 
18
- import orjson
19
18
  import requests
19
+ from orjson import orjson
20
20
  from requests import PreparedRequest, Response, Session
21
21
 
22
22
  from airbyte_cdk.connector import TConfig
@@ -129,11 +129,7 @@ class AirbyteEntrypoint(object):
129
129
 
130
130
  source_spec: ConnectorSpecification = self.source.spec(self.logger)
131
131
  try:
132
- with tempfile.TemporaryDirectory(
133
- # Cleanup can fail on Windows due to file locks. Ignore if so,
134
- # rather than failing the whole process.
135
- ignore_cleanup_errors=True,
136
- ) as temp_dir:
132
+ with tempfile.TemporaryDirectory() as temp_dir:
137
133
  os.environ[ENV_REQUEST_CACHE_PATH] = (
138
134
  temp_dir # set this as default directory for request_cache to store *.sqlite files
139
135
  )
@@ -250,18 +246,12 @@ class AirbyteEntrypoint(object):
250
246
  ) -> AirbyteMessage:
251
247
  match message.type:
252
248
  case Type.RECORD:
253
- if message.record is None:
254
- raise ValueError("Record message must have a record attribute")
255
-
256
249
  stream_message_count[
257
250
  HashableStreamDescriptor(
258
251
  name=message.record.stream, namespace=message.record.namespace
259
252
  )
260
253
  ] += 1.0 # type: ignore[union-attr] # record has `stream` and `namespace`
261
254
  case Type.STATE:
262
- if message.state is None:
263
- raise ValueError("State message must have a state attribute")
264
-
265
255
  stream_descriptor = message_utils.get_stream_descriptor(message)
266
256
 
267
257
  # Set record count from the counter onto the state message
@@ -200,23 +200,23 @@ class ConcurrentDeclarativeSource(ManifestDeclarativeSource, Generic[TState]):
200
200
  # Some low-code sources use a combination of DeclarativeStream and regular Python streams. We can't inspect
201
201
  # these legacy Python streams the way we do low-code streams to determine if they are concurrent compatible,
202
202
  # so we need to treat them as synchronous
203
- if (
204
- isinstance(declarative_stream, DeclarativeStream)
205
- and name_to_stream_mapping[declarative_stream.name].get("retriever")["type"]
206
- == "SimpleRetriever"
207
- ):
203
+ if isinstance(declarative_stream, DeclarativeStream):
208
204
  incremental_sync_component_definition = name_to_stream_mapping[
209
205
  declarative_stream.name
210
206
  ].get("incremental_sync")
211
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
+ )
212
215
  partition_router_component_definition = (
213
216
  name_to_stream_mapping[declarative_stream.name]
214
217
  .get("retriever")
215
218
  .get("partition_router")
216
219
  )
217
- is_without_partition_router_or_cursor = not bool(
218
- incremental_sync_component_definition
219
- ) and not bool(partition_router_component_definition)
220
220
 
221
221
  is_substream_without_incremental = (
222
222
  partition_router_component_definition
@@ -272,8 +272,9 @@ class ConcurrentDeclarativeSource(ManifestDeclarativeSource, Generic[TState]):
272
272
  )
273
273
  )
274
274
  elif (
275
- is_substream_without_incremental or is_without_partition_router_or_cursor
276
- ) and hasattr(declarative_stream.retriever, "stream_slicer"):
275
+ is_substream_without_incremental
276
+ and hasattr(declarative_stream.retriever, "stream_slicer")
277
+ ) or is_without_partition_router_or_cursor:
277
278
  partition_generator = StreamSlicerPartitionGenerator(
278
279
  DeclarativePartitionFactory(
279
280
  declarative_stream.name,
@@ -314,12 +315,10 @@ class ConcurrentDeclarativeSource(ManifestDeclarativeSource, Generic[TState]):
314
315
  return concurrent_streams, synchronous_streams
315
316
 
316
317
  def _is_datetime_incremental_without_partition_routing(
317
- self,
318
- declarative_stream: DeclarativeStream,
319
- incremental_sync_component_definition: Mapping[str, Any],
320
- ) -> bool:
318
+ self, declarative_stream, incremental_sync_component_definition
319
+ ):
321
320
  return (
322
- bool(incremental_sync_component_definition)
321
+ incremental_sync_component_definition
323
322
  and incremental_sync_component_definition.get("type", "")
324
323
  == DatetimeBasedCursorModel.__name__
325
324
  and self._stream_supports_concurrent_partition_processing(
@@ -13,15 +13,8 @@ def get_primary_key_from_stream(
13
13
  elif isinstance(stream_primary_key, str):
14
14
  return [stream_primary_key]
15
15
  elif isinstance(stream_primary_key, list):
16
- are_all_elements_str = all(isinstance(k, str) for k in stream_primary_key)
17
- are_all_elements_list_of_size_one = all(
18
- isinstance(k, list) and len(k) == 1 for k in stream_primary_key
19
- )
20
-
21
- if are_all_elements_str:
16
+ if len(stream_primary_key) > 0 and all(isinstance(k, str) for k in stream_primary_key):
22
17
  return stream_primary_key # type: ignore # We verified all items in the list are strings
23
- elif are_all_elements_list_of_size_one:
24
- return list(map(lambda x: x[0], stream_primary_key))
25
18
  else:
26
19
  raise ValueError(f"Nested primary keys are not supported. Found {stream_primary_key}")
27
20
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: airbyte-cdk
3
- Version: 6.8.0
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
@@ -22,7 +22,7 @@ airbyte_cdk/destinations/vector_db_based/indexer.py,sha256=beiSi2Uu67EoTr7yQSaCJ
22
22
  airbyte_cdk/destinations/vector_db_based/test_utils.py,sha256=MkqLiOJ5QyKbV4rNiJhe-BHM7FD-ADHQ4bQGf4c5lRY,1932
23
23
  airbyte_cdk/destinations/vector_db_based/utils.py,sha256=FOyEo8Lc-fY8UyhpCivhZtIqBRyxf3cUt6anmK03fUY,1127
24
24
  airbyte_cdk/destinations/vector_db_based/writer.py,sha256=nPj1DtZ1-tkEBAz7Ape1FZz_YDQNXPceUyCoviVq3Fk,4525
25
- airbyte_cdk/entrypoint.py,sha256=eG-SfN4PfvkbVLfZMCPI21QAJwox6e2RMr_xN__p-gA,18039
25
+ airbyte_cdk/entrypoint.py,sha256=B0kd8NWYs6pFDC75OoPxiGNcIh9jZDnU9qIVvtOQsNE,17605
26
26
  airbyte_cdk/exception_handler.py,sha256=D_doVl3Dt60ASXlJsfviOCswxGyKF2q0RL6rif3fNks,2013
27
27
  airbyte_cdk/logger.py,sha256=ckavMoaV-p0rxQANyrRynVw8eysO7ZNoCGfKzHNYNB8,3758
28
28
  airbyte_cdk/models/__init__.py,sha256=5n8LEEQviDBmdZQPG4vnccWgsKpS4Q4L8MI7LUfIEsY,2051
@@ -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=4bpS63fz2K4mLPF33eG1xXgGRzzjjBAvpgDbiDrIs_Q,23549
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
@@ -248,7 +248,7 @@ airbyte_cdk/sources/streams/concurrent/availability_strategy.py,sha256=xqErZU9v9
248
248
  airbyte_cdk/sources/streams/concurrent/cursor.py,sha256=JX1MEtQZzRhYlr8wghBd5uC5geO7_Xh2aA4wIFDLE8s,20897
249
249
  airbyte_cdk/sources/streams/concurrent/default_stream.py,sha256=K3rLMpYhS7nnmvwQ52lqBy7DQdFMJpvvT7sgBg_ckA8,3207
250
250
  airbyte_cdk/sources/streams/concurrent/exceptions.py,sha256=JOZ446MCLpmF26r9KfS6OO_6rGjcjgJNZdcw6jccjEI,468
251
- airbyte_cdk/sources/streams/concurrent/helpers.py,sha256=S6AW8TgIASCZ2UuUcQLE8OzgYUHWt2-KPOvNPwnQf-Q,1596
251
+ airbyte_cdk/sources/streams/concurrent/helpers.py,sha256=gtj9p0clZwgnClrIRH6V2Wl0Jwu11Plq-9FP4FU2VQA,1327
252
252
  airbyte_cdk/sources/streams/concurrent/partition_enqueuer.py,sha256=2t64b_z9cEPmlHZnjSiMTO8PEtEdiAJDG0JcYOtUqAE,3363
253
253
  airbyte_cdk/sources/streams/concurrent/partition_reader.py,sha256=0TIrjbTzYJGdA0AZUzbeIKr0iHbawnoEKVl7bWxOFZY,1760
254
254
  airbyte_cdk/sources/streams/concurrent/partitions/__init__.py,sha256=4Hw-PX1-VgESLF16cDdvuYCzGJtHntThLF4qIiULWeo,61
@@ -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.8.0.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
334
- airbyte_cdk-6.8.0.dist-info/METADATA,sha256=ITCA7CjjzLnu4ioCSKaa6O7DUBKEGRBh_FkvkAI-PMs,13519
335
- airbyte_cdk-6.8.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
336
- airbyte_cdk-6.8.0.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
337
- airbyte_cdk-6.8.0.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,,