airbyte-cdk 0.69.0__py3-none-any.whl → 0.69.2__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py +7 -4
- airbyte_cdk/test/entrypoint_wrapper.py +1 -1
- {airbyte_cdk-0.69.0.dist-info → airbyte_cdk-0.69.2.dist-info}/METADATA +1 -1
- {airbyte_cdk-0.69.0.dist-info → airbyte_cdk-0.69.2.dist-info}/RECORD +9 -9
- {airbyte_cdk-0.69.0.dist-info → airbyte_cdk-0.69.2.dist-info}/WHEEL +1 -1
- unit_tests/sources/declarative/parsers/test_model_to_component_factory.py +14 -0
- unit_tests/test/test_entrypoint_wrapper.py +9 -6
- {airbyte_cdk-0.69.0.dist-info → airbyte_cdk-0.69.2.dist-info}/LICENSE.txt +0 -0
- {airbyte_cdk-0.69.0.dist-info → airbyte_cdk-0.69.2.dist-info}/top_level.txt +0 -0
@@ -319,7 +319,7 @@ class ModelToComponentFactory:
|
|
319
319
|
)
|
320
320
|
if model.request_authentication.type == "Bearer":
|
321
321
|
return ModelToComponentFactory.create_bearer_authenticator(
|
322
|
-
BearerAuthenticatorModel(type="BearerAuthenticator", api_token=""),
|
322
|
+
BearerAuthenticatorModel(type="BearerAuthenticator", api_token=""), # type: ignore # $parameters has a default value
|
323
323
|
config,
|
324
324
|
token_provider=token_provider, # type: ignore # $parameters defaults to None
|
325
325
|
)
|
@@ -431,11 +431,14 @@ class ModelToComponentFactory:
|
|
431
431
|
return custom_component_class(**kwargs)
|
432
432
|
|
433
433
|
@staticmethod
|
434
|
-
def _get_class_from_fully_qualified_class_name(
|
435
|
-
split =
|
434
|
+
def _get_class_from_fully_qualified_class_name(full_qualified_class_name: str) -> Any:
|
435
|
+
split = full_qualified_class_name.split(".")
|
436
436
|
module = ".".join(split[:-1])
|
437
437
|
class_name = split[-1]
|
438
|
-
|
438
|
+
try:
|
439
|
+
return getattr(importlib.import_module(module), class_name)
|
440
|
+
except AttributeError:
|
441
|
+
raise ValueError(f"Could not load class {full_qualified_class_name}.")
|
439
442
|
|
440
443
|
@staticmethod
|
441
444
|
def _derive_component_type_from_type_hints(field_type: Any) -> Optional[str]:
|
@@ -74,7 +74,7 @@ class EntrypointOutput:
|
|
74
74
|
state_messages = self._get_message_by_types([Type.STATE])
|
75
75
|
if not state_messages:
|
76
76
|
raise ValueError("Can't provide most recent state as there are no state messages")
|
77
|
-
return state_messages[-1].state.
|
77
|
+
return state_messages[-1].state.stream
|
78
78
|
|
79
79
|
@property
|
80
80
|
def logs(self) -> List[AirbyteMessage]:
|
@@ -87,7 +87,7 @@ airbyte_cdk/sources/declarative/parsers/custom_exceptions.py,sha256=y7_G5mM07zxT
|
|
87
87
|
airbyte_cdk/sources/declarative/parsers/default_implementation_registry.py,sha256=W8BcK4KOg4ifNXgsdeIoV4oneHjXBKcPHEZHIC4r-hM,3801
|
88
88
|
airbyte_cdk/sources/declarative/parsers/manifest_component_transformer.py,sha256=i2yUdrdlPUHI0dSQX0zBT8WSg912SMiCF8qkQ8VvlA4,8287
|
89
89
|
airbyte_cdk/sources/declarative/parsers/manifest_reference_resolver.py,sha256=6ukHx0bBrCJm9rek1l_MEfS3U_gdJcM4pJRyifJEOp0,6412
|
90
|
-
airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=
|
90
|
+
airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=_jX1sPW5SA51nHoxpoVktC3jdO8PR4cGrQfZftcVSLo,59316
|
91
91
|
airbyte_cdk/sources/declarative/partition_routers/__init__.py,sha256=27sOWhw2LBQs62HchURakHQ2M_mtnOatNgU6q8RUtpU,476
|
92
92
|
airbyte_cdk/sources/declarative/partition_routers/list_partition_router.py,sha256=L22D-up7W2HahZZo2dA-IbRSs7qJEahU6O6bU0eiIt8,4324
|
93
93
|
airbyte_cdk/sources/declarative/partition_routers/single_partition_router.py,sha256=cl-TQdu_m6_IF20gdD1jll0SpejIyMZHvyGXx2NafuI,1611
|
@@ -249,7 +249,7 @@ airbyte_cdk/sources/utils/transform.py,sha256=4GYmO6bq33HF-a1in0dKQKqUOYI1bWItyu
|
|
249
249
|
airbyte_cdk/sources/utils/types.py,sha256=41ZQR681t5TUnOScij58d088sb99klH_ZENFcaYro_g,175
|
250
250
|
airbyte_cdk/test/__init__.py,sha256=f_XdkOg4_63QT2k3BbKY34209lppwgw-svzfZstQEq4,199
|
251
251
|
airbyte_cdk/test/catalog_builder.py,sha256=cxhDAFpz9-AvMq81HHHK3u6TwdT16ngGUfrP3E53nNI,963
|
252
|
-
airbyte_cdk/test/entrypoint_wrapper.py,sha256
|
252
|
+
airbyte_cdk/test/entrypoint_wrapper.py,sha256=-fqWTOI1XWGqQdAxl0-nTNU48MZnJWd2CmOwZe7ol-U,7399
|
253
253
|
airbyte_cdk/test/state_builder.py,sha256=SlKadhKVi38ZSKMeceVAxjowxsDDT9vJoG6gU4zDrQE,705
|
254
254
|
airbyte_cdk/test/mock_http/__init__.py,sha256=uil6k-0NbUyDFZXtWw88HaS7r13i43VzA9H7hOHzZx8,322
|
255
255
|
airbyte_cdk/test/mock_http/matcher.py,sha256=J4C8g8PkdKo4OwHWMJGYJIyrLnQpXI5gXWUtyxsxHpM,1240
|
@@ -329,7 +329,7 @@ unit_tests/sources/declarative/interpolation/test_macros.py,sha256=vEZmHQ0KsfQUz
|
|
329
329
|
unit_tests/sources/declarative/parsers/__init__.py,sha256=ZnqYNxHsKCgO38IwB34RQyRMXTs4GTvlRi3ImKnIioo,61
|
330
330
|
unit_tests/sources/declarative/parsers/test_manifest_component_transformer.py,sha256=egePHWYcXprfPtoHhiquWAXuJkDr-DB_RakKhdyaoHs,14316
|
331
331
|
unit_tests/sources/declarative/parsers/test_manifest_reference_resolver.py,sha256=K3q9eyx-sJFQ8nGYjAgS7fxau4sX_FlNreEAjiCYOeE,5306
|
332
|
-
unit_tests/sources/declarative/parsers/test_model_to_component_factory.py,sha256=
|
332
|
+
unit_tests/sources/declarative/parsers/test_model_to_component_factory.py,sha256=WIUygDJvNGEIzNdlarkYymTTgRtiXlR6IOjwnsqlC3E,75683
|
333
333
|
unit_tests/sources/declarative/parsers/testing_components.py,sha256=_yUijmYRM-yYHPGDB2JsfEiOuVrgexGW9QwHf1xxNW8,1326
|
334
334
|
unit_tests/sources/declarative/partition_routers/__init__.py,sha256=O8MZg4Bv_DghdRy9BoJCPIqdV75VtiUrhEkExQgb2nE,61
|
335
335
|
unit_tests/sources/declarative/partition_routers/test_list_partition_router.py,sha256=WKdbAQCHfCVOyoAFM_kbHsbqAF_e5FX5Zvou5ARsJZ4,6572
|
@@ -444,7 +444,7 @@ unit_tests/sources/streams/http/auth/test_auth.py,sha256=05jyXGhKxZrOLfR97weNDeg
|
|
444
444
|
unit_tests/sources/streams/http/requests_native_auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
445
445
|
unit_tests/sources/streams/http/requests_native_auth/test_requests_native_auth.py,sha256=FG9ug7xXyyWI0iS5ZsCzzrVNZMpq7EtVkQSx_cUbp68,19474
|
446
446
|
unit_tests/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
447
|
-
unit_tests/test/test_entrypoint_wrapper.py,sha256=
|
447
|
+
unit_tests/test/test_entrypoint_wrapper.py,sha256=WI46PODALY8IvDRreQiJyuFoxbimoiO62MP6NaBHInk,11178
|
448
448
|
unit_tests/test/mock_http/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
449
449
|
unit_tests/test/mock_http/test_matcher.py,sha256=dBndYzqvo3AdHRilLrqruXdPviwi91gWt-ubDsGb-yg,2327
|
450
450
|
unit_tests/test/mock_http/test_mocker.py,sha256=sOoWutnrPDKB99Y3bkEyr3HFELGivwuklVJ_ii8C-ew,8523
|
@@ -459,8 +459,8 @@ unit_tests/utils/test_schema_inferrer.py,sha256=Z2jHBZ540wnYkylIdV_2xr75Vtwlxuyg
|
|
459
459
|
unit_tests/utils/test_secret_utils.py,sha256=CdKK8A2-5XVxbXVtX22FK9dwwMeP5KNqDH6luWRXSNw,5256
|
460
460
|
unit_tests/utils/test_stream_status_utils.py,sha256=Xr8MZ2HWgTVIyMbywDvuYkRaUF4RZLQOT8-JjvcfR24,2970
|
461
461
|
unit_tests/utils/test_traced_exception.py,sha256=bDFP5zMBizFenz6V2WvEZTRCKGB5ijh3DBezjbfoYIs,4198
|
462
|
-
airbyte_cdk-0.69.
|
463
|
-
airbyte_cdk-0.69.
|
464
|
-
airbyte_cdk-0.69.
|
465
|
-
airbyte_cdk-0.69.
|
466
|
-
airbyte_cdk-0.69.
|
462
|
+
airbyte_cdk-0.69.2.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
|
463
|
+
airbyte_cdk-0.69.2.dist-info/METADATA,sha256=wnxHVH0ud4kbRmo5hNf_qy0Gae-ahhomVw8RRAUKbls,11074
|
464
|
+
airbyte_cdk-0.69.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
465
|
+
airbyte_cdk-0.69.2.dist-info/top_level.txt,sha256=edvsDKTnE6sD2wfCUaeTfKf5gQIL6CPVMwVL2sWZzqo,51
|
466
|
+
airbyte_cdk-0.69.2.dist-info/RECORD,,
|
@@ -1239,6 +1239,20 @@ def test_create_default_paginator():
|
|
1239
1239
|
ValueError,
|
1240
1240
|
id="test_create_custom_component_missing_required_field_emits_error",
|
1241
1241
|
),
|
1242
|
+
pytest.param(
|
1243
|
+
{
|
1244
|
+
"type": "CustomErrorHandler",
|
1245
|
+
"class_name": "unit_tests.sources.declarative.parsers.testing_components.NonExistingClass",
|
1246
|
+
"paginator": {
|
1247
|
+
"type": "DefaultPaginator",
|
1248
|
+
"pagination_strategy": {"type": "OffsetIncrement", "page_size": 10},
|
1249
|
+
},
|
1250
|
+
},
|
1251
|
+
"paginator",
|
1252
|
+
None,
|
1253
|
+
ValueError,
|
1254
|
+
id="test_create_custom_component_non_existing_class_raises_value_error",
|
1255
|
+
),
|
1242
1256
|
],
|
1243
1257
|
)
|
1244
1258
|
def test_create_custom_components(manifest, field_name, expected_value, expected_error):
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import json
|
4
4
|
import logging
|
5
5
|
import os
|
6
|
-
from typing import Any, Iterator, List
|
6
|
+
from typing import Any, Iterator, List, Mapping
|
7
7
|
from unittest import TestCase
|
8
8
|
from unittest.mock import Mock, patch
|
9
9
|
|
@@ -16,7 +16,9 @@ from airbyte_protocol.models import (
|
|
16
16
|
AirbyteLogMessage,
|
17
17
|
AirbyteMessage,
|
18
18
|
AirbyteRecordMessage,
|
19
|
+
AirbyteStateBlob,
|
19
20
|
AirbyteStateMessage,
|
21
|
+
AirbyteStreamState,
|
20
22
|
AirbyteStreamStatus,
|
21
23
|
AirbyteStreamStatusTraceMessage,
|
22
24
|
AirbyteTraceMessage,
|
@@ -28,8 +30,8 @@ from airbyte_protocol.models import (
|
|
28
30
|
)
|
29
31
|
|
30
32
|
|
31
|
-
def _a_state_message(
|
32
|
-
return AirbyteMessage(type=Type.STATE, state=AirbyteStateMessage(
|
33
|
+
def _a_state_message(stream_name: str, stream_state: Mapping[str, Any]) -> AirbyteMessage:
|
34
|
+
return AirbyteMessage(type=Type.STATE, state=AirbyteStateMessage(stream=AirbyteStreamState(stream_descriptor=StreamDescriptor(name=stream_name), stream_state=AirbyteStateBlob(**stream_state))))
|
33
35
|
|
34
36
|
|
35
37
|
def _a_status_message(stream_name: str, status: AirbyteStreamStatus) -> AirbyteMessage:
|
@@ -49,7 +51,7 @@ def _a_status_message(stream_name: str, status: AirbyteStreamStatus) -> AirbyteM
|
|
49
51
|
_A_RECORD = AirbyteMessage(
|
50
52
|
type=Type.RECORD, record=AirbyteRecordMessage(stream="stream", data={"record key": "record value"}, emitted_at=0)
|
51
53
|
)
|
52
|
-
_A_STATE_MESSAGE = _a_state_message({"state key": "state value for _A_STATE_MESSAGE"})
|
54
|
+
_A_STATE_MESSAGE = _a_state_message("stream_name", {"state key": "state value for _A_STATE_MESSAGE"})
|
53
55
|
_A_LOG = AirbyteMessage(type=Type.LOG, log=AirbyteLogMessage(level=Level.INFO, message="This is an Airbyte log message"))
|
54
56
|
_AN_ERROR_MESSAGE = AirbyteMessage(
|
55
57
|
type=Type.TRACE,
|
@@ -176,8 +178,9 @@ class EntrypointWrapperTest(TestCase):
|
|
176
178
|
|
177
179
|
@patch("airbyte_cdk.test.entrypoint_wrapper.AirbyteEntrypoint")
|
178
180
|
def test_given_many_state_messages_and_records_when_read_then_output_has_records_and_state_message(self, entrypoint):
|
179
|
-
|
180
|
-
|
181
|
+
state_value = {"state_key": "last state value"}
|
182
|
+
last_emitted_state = AirbyteStreamState(stream_descriptor=StreamDescriptor(name="stream_name"), stream_state=AirbyteStateBlob(**state_value))
|
183
|
+
entrypoint.return_value.run.return_value = _to_entrypoint_output([_A_STATE_MESSAGE, _a_state_message("stream_name", state_value)])
|
181
184
|
|
182
185
|
output = read(self._a_source, _A_CONFIG, _A_CATALOG, _A_STATE)
|
183
186
|
|
File without changes
|
File without changes
|