airbyte-cdk 0.69.0__py3-none-any.whl → 0.69.1__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.data
77
+ return state_messages[-1].state.stream
78
78
 
79
79
  @property
80
80
  def logs(self) -> List[AirbyteMessage]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: airbyte-cdk
3
- Version: 0.69.0
3
+ Version: 0.69.1
4
4
  Summary: A framework for writing Airbyte Connectors.
5
5
  Home-page: https://github.com/airbytehq/airbyte
6
6
  Author: Airbyte
@@ -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=uTOEYoWkYnbkooPJ4a4gZ-NEll5j1tTCAzIG5lBroI4,7397
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
@@ -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=hFr-pWqJz1VsIkwh1O6BrPl2rH09_sAz_mZeWV9iSBo,10807
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.0.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
463
- airbyte_cdk-0.69.0.dist-info/METADATA,sha256=3qyDXSdVmneP0TAlzZpHoNcRH4n5DbMOtIHwFlf0gxY,11074
464
- airbyte_cdk-0.69.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
465
- airbyte_cdk-0.69.0.dist-info/top_level.txt,sha256=edvsDKTnE6sD2wfCUaeTfKf5gQIL6CPVMwVL2sWZzqo,51
466
- airbyte_cdk-0.69.0.dist-info/RECORD,,
462
+ airbyte_cdk-0.69.1.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
463
+ airbyte_cdk-0.69.1.dist-info/METADATA,sha256=E5q4NBAl0Aq4UO700Bg2PYQcW-YH7ED4P7yUSPbhNWs,11074
464
+ airbyte_cdk-0.69.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
465
+ airbyte_cdk-0.69.1.dist-info/top_level.txt,sha256=edvsDKTnE6sD2wfCUaeTfKf5gQIL6CPVMwVL2sWZzqo,51
466
+ airbyte_cdk-0.69.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.42.0)
2
+ Generator: bdist_wheel (0.43.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -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(state: Any) -> AirbyteMessage:
32
- return AirbyteMessage(type=Type.STATE, state=AirbyteStateMessage(data=state))
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
- last_emitted_state = {"last state key": "last state value"}
180
- entrypoint.return_value.run.return_value = _to_entrypoint_output([_A_STATE_MESSAGE, _a_state_message(last_emitted_state)])
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