Skip to content

Commit 0f785c1

Browse files
committed
fix state deserialization issue
1 parent f9a7ed2 commit 0f785c1

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

airbyte_cdk/models/airbyte_protocol.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
33
#
44

5+
"""
6+
This file is necessary because the `AirbyteStateBlob` implementation in the protocol lib is incomplete and given we use the incomplete implementation, we will get `TypeError: AirbyteStateBlob.__init__() takes 1 positional argument but 2 were given`. Hence, we need to redefine all the classes that could serialize AirbyteStateBlob to use the CDK implementation, not the protocol lib one.
7+
"""
8+
59
from dataclasses import InitVar, dataclass
610
from typing import Annotated, Any, Dict, List, Mapping, Optional, Union
711

@@ -86,3 +90,4 @@ class AirbyteMessage:
8690
state: Optional[AirbyteStateMessage] = None
8791
trace: Optional[AirbyteTraceMessage] = None # type: ignore [name-defined]
8892
control: Optional[AirbyteControlMessage] = None # type: ignore [name-defined]
93+
destination_catalog: Optional[DestinationCatalog] = None # type: ignore [name-defined]

airbyte_cdk/models/airbyte_protocol_serializers.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
22
from typing import Any, Dict
33

4-
from airbyte_protocol_dataclasses.models import ( # type: ignore[attr-defined] # all classes are imported to airbyte_protocol via *
4+
from .airbyte_protocol import ( # type: ignore[attr-defined] # all classes are imported to airbyte_protocol via *
55
AirbyteMessage,
6-
AirbyteStateMessage,
6+
AirbyteStateBlob,
77
AirbyteStreamState,
88
ConfiguredAirbyteCatalog,
99
ConfiguredAirbyteStream,
1010
ConnectorSpecification,
1111
)
1212
from serpyco_rs import CustomType, Serializer
1313

14-
from .airbyte_protocol import AirbyteStateBlob
1514

1615

1716
class AirbyteStateBlobType(CustomType[AirbyteStateBlob, Dict[str, Any]]):

0 commit comments

Comments
 (0)