airbyte-cdk 6.38.2__py3-none-any.whl → 6.38.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.
@@ -1476,7 +1476,19 @@ class ModelToComponentFactory:
1476
1476
  try:
1477
1477
  module_ref = importlib.import_module(module_name_full)
1478
1478
  except ModuleNotFoundError as e:
1479
- raise ValueError(f"Could not load module `{module_name_full}`.") from e
1479
+ if split[0] == "source_declarative_manifest":
1480
+ # During testing, the modules containing the custom components are not moved to source_declarative_manifest. In order to run the test, add the source folder to your PYTHONPATH or add it runtime using sys.path.append
1481
+ try:
1482
+ import os
1483
+
1484
+ module_name_with_source_declarative_manifest = ".".join(split[1:-1])
1485
+ module_ref = importlib.import_module(
1486
+ module_name_with_source_declarative_manifest
1487
+ )
1488
+ except ModuleNotFoundError:
1489
+ raise ValueError(f"Could not load module `{module_name_full}`.") from e
1490
+ else:
1491
+ raise ValueError(f"Could not load module `{module_name_full}`.") from e
1480
1492
 
1481
1493
  try:
1482
1494
  return getattr(module_ref, class_name)
@@ -39,13 +39,18 @@ class YamlDeclarativeSource(ConcurrentDeclarativeSource[List[AirbyteStateMessage
39
39
  )
40
40
 
41
41
  def _read_and_parse_yaml_file(self, path_to_yaml_file: str) -> ConnectionDefinition:
42
- package = self.__class__.__module__.split(".")[0]
42
+ try:
43
+ # For testing purposes, we want to allow to just pass a file
44
+ with open(path_to_yaml_file, "r") as f:
45
+ return yaml.safe_load(f) # type: ignore # we assume the yaml represents a ConnectionDefinition
46
+ except FileNotFoundError:
47
+ # Running inside the container, the working directory during an operation is not structured the same as the static files
48
+ package = self.__class__.__module__.split(".")[0]
43
49
 
44
- yaml_config = pkgutil.get_data(package, path_to_yaml_file)
45
- if yaml_config:
46
- decoded_yaml = yaml_config.decode()
47
- return self._parse(decoded_yaml)
48
- else:
50
+ yaml_config = pkgutil.get_data(package, path_to_yaml_file)
51
+ if yaml_config:
52
+ decoded_yaml = yaml_config.decode()
53
+ return self._parse(decoded_yaml)
49
54
  return {}
50
55
 
51
56
  def _emit_manifest_debug_message(self, extra_args: dict[str, Any]) -> None:
@@ -276,7 +276,7 @@ class StreamPartition(Partition):
276
276
  def read(self) -> Iterable[Record]:
277
277
  """
278
278
  Read messages from the stream.
279
- If the StreamData is a Mapping, it will be converted to a Record.
279
+ If the StreamData is a Mapping or an AirbyteMessage of type RECORD, it will be converted to a Record.
280
280
  Otherwise, the message will be emitted on the message repository.
281
281
  """
282
282
  try:
@@ -292,6 +292,8 @@ class StreamPartition(Partition):
292
292
  stream_slice=copy.deepcopy(self._slice),
293
293
  stream_state=self._state,
294
294
  ):
295
+ # Noting we'll also need to support FileTransferRecordMessage if we want to support file-based connectors in this facade
296
+ # For now, file-based connectors have their own stream facade
295
297
  if isinstance(record_data, Mapping):
296
298
  data_to_return = dict(record_data)
297
299
  self._stream.transformer.transform(
@@ -302,6 +304,12 @@ class StreamPartition(Partition):
302
304
  stream_name=self.stream_name(),
303
305
  associated_slice=self._slice, # type: ignore [arg-type]
304
306
  )
307
+ elif isinstance(record_data, AirbyteMessage) and record_data.record is not None:
308
+ yield Record(
309
+ data=record_data.record.data or {},
310
+ stream_name=self.stream_name(),
311
+ associated_slice=self._slice, # type: ignore [arg-type]
312
+ )
305
313
  else:
306
314
  self._message_repository.emit_message(record_data)
307
315
  except Exception as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: airbyte-cdk
3
- Version: 6.38.2
3
+ Version: 6.38.3
4
4
  Summary: A framework for writing Airbyte Connectors.
5
5
  Home-page: https://airbyte.com
6
6
  License: MIT
@@ -120,7 +120,7 @@ airbyte_cdk/sources/declarative/parsers/custom_code_compiler.py,sha256=jDw_TttD3
120
120
  airbyte_cdk/sources/declarative/parsers/custom_exceptions.py,sha256=Rir9_z3Kcd5Es0-LChrzk-0qubAsiK_RSEnLmK2OXm8,553
121
121
  airbyte_cdk/sources/declarative/parsers/manifest_component_transformer.py,sha256=CXwTfD3wSQq3okcqwigpprbHhSURUokh4GK2OmOyKC8,9132
122
122
  airbyte_cdk/sources/declarative/parsers/manifest_reference_resolver.py,sha256=IWUOdF03o-aQn0Occo1BJCxU0Pz-QILk5L67nzw2thw,6803
123
- airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=XR8audWus2hSSsNPDGJBR4thAwU4vS7r2S7d1gyonL4,141703
123
+ airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=4FEIBgkAn85qmOEjmi8rRPBERdktNpOFjXGbw0Fsau8,142441
124
124
  airbyte_cdk/sources/declarative/partition_routers/__init__.py,sha256=HJ-Syp3p7RpyR_OK0X_a2kSyISfu3W-PKrRI16iY0a8,957
125
125
  airbyte_cdk/sources/declarative/partition_routers/async_job_partition_router.py,sha256=VelO7zKqKtzMJ35jyFeg0ypJLQC0plqqIBNXoBW1G2E,3001
126
126
  airbyte_cdk/sources/declarative/partition_routers/cartesian_product_stream_slicer.py,sha256=c5cuVFM6NFkuQqG8Z5IwkBuwDrvXZN1CunUOM_L0ezg,6892
@@ -194,7 +194,7 @@ airbyte_cdk/sources/declarative/transformations/keys_to_snake_transformation.py,
194
194
  airbyte_cdk/sources/declarative/transformations/remove_fields.py,sha256=EwUP0SZ2p4GRJ6Q8CUzlz9dcUeEidEFDlI2IBye2tlc,2745
195
195
  airbyte_cdk/sources/declarative/transformations/transformation.py,sha256=4sXtx9cNY2EHUPq-xHvDs8GQEBUy3Eo6TkRLKHPXx68,1161
196
196
  airbyte_cdk/sources/declarative/types.py,sha256=yqx0xlZv_76tkC7fqJKefmvl4GJJ8mXbeddwVV8XRJU,778
197
- airbyte_cdk/sources/declarative/yaml_declarative_source.py,sha256=swZUN7g_AuLeE7n1yp_cquK7DBB082lZUSMIBNEHxgs,2290
197
+ airbyte_cdk/sources/declarative/yaml_declarative_source.py,sha256=nJCZkzLGP-dwvfwKsl4VqQFZQdhx6fiGCRez1gma0wE,2714
198
198
  airbyte_cdk/sources/file_based/README.md,sha256=iMqww4VZ882jfNQIdljjDgqreKs-mkdtSrRKA94iX6A,11085
199
199
  airbyte_cdk/sources/file_based/__init__.py,sha256=EaxHv_9ot-eRlUCR47ZMZ0IOtB-n0HH24om7Bfn-uuQ,868
200
200
  airbyte_cdk/sources/file_based/availability_strategy/__init__.py,sha256=ddKQfUmk-Ls7LJaG8gtrqDybG3d8S7KXOAEjLeYLrTg,399
@@ -264,7 +264,7 @@ airbyte_cdk/sources/streams/concurrent/README.md,sha256=0nvgnlCBfZJiPDAofT8yFmUh
264
264
  airbyte_cdk/sources/streams/concurrent/__init__.py,sha256=4Hw-PX1-VgESLF16cDdvuYCzGJtHntThLF4qIiULWeo,61
265
265
  airbyte_cdk/sources/streams/concurrent/abstract_stream.py,sha256=3OB5VsvOkJmCxIMABKgdJAwvCdZtkxeaAVrUNIW3jMQ,3902
266
266
  airbyte_cdk/sources/streams/concurrent/abstract_stream_facade.py,sha256=QTry1QCBUwJDw1QSCEvz23s7zIEx_7QMxkPq9j-oPIQ,1358
267
- airbyte_cdk/sources/streams/concurrent/adapters.py,sha256=QP_64kQo-b3sRNHZA5aqrgCJqAhIVegRM3vJ8jGyuSY,15213
267
+ airbyte_cdk/sources/streams/concurrent/adapters.py,sha256=aZtJ_75gVPmoCS-URtfQQX8mYId5xk5Q5mLQYeTM0N4,15814
268
268
  airbyte_cdk/sources/streams/concurrent/availability_strategy.py,sha256=4La5v2UffSjGnhmF4kwNIKt_g3RXk2ux1mSHA1ejgYM,2898
269
269
  airbyte_cdk/sources/streams/concurrent/clamping.py,sha256=i26GVyui2ScEXSP-IP_61K2HaTp1-6lTlYHsZVYpuZA,3240
270
270
  airbyte_cdk/sources/streams/concurrent/cursor.py,sha256=LFXbKBEMtNSVz_kZs9qydS9fPvzTU5wdgXRagRRJeHo,21388
@@ -357,9 +357,9 @@ airbyte_cdk/utils/slice_hasher.py,sha256=EDxgROHDbfG-QKQb59m7h_7crN1tRiawdf5uU7G
357
357
  airbyte_cdk/utils/spec_schema_transformations.py,sha256=-5HTuNsnDBAhj-oLeQXwpTGA0HdcjFOf2zTEMUTTg_Y,816
358
358
  airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
359
359
  airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
360
- airbyte_cdk-6.38.2.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
361
- airbyte_cdk-6.38.2.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
362
- airbyte_cdk-6.38.2.dist-info/METADATA,sha256=V0WnXychDR87z8Q_ihtNonBPf4AKCU7frOMzY57zbSw,6013
363
- airbyte_cdk-6.38.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
364
- airbyte_cdk-6.38.2.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
365
- airbyte_cdk-6.38.2.dist-info/RECORD,,
360
+ airbyte_cdk-6.38.3.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
361
+ airbyte_cdk-6.38.3.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
362
+ airbyte_cdk-6.38.3.dist-info/METADATA,sha256=8jMYkKC_ie6Xm0bs5_gB5FcSirgKCNaCrUL4Rz01YIM,6013
363
+ airbyte_cdk-6.38.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
364
+ airbyte_cdk-6.38.3.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
365
+ airbyte_cdk-6.38.3.dist-info/RECORD,,