Skip to content

Commit 155d58d

Browse files
authored
docs(airbyte-cdk): update migration guide (#45153)
Signed-off-by: Artem Inzhyyants <[email protected]>
1 parent dd2d443 commit 155d58d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

airbyte-cdk/python/cdk-migrations.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,23 @@ The changes to Airbyte CDK itself are backwards-compatible, but some changes are
99
- uses the `airbyte_protocol` models directly, or `airbyte_cdk.models`, which points to `airbyte_protocol` models
1010
- uses third-party libraries, such as `pandas`, to read data from sources, which output non-native Python objects that cannot be serialized by the [orjson](https://github.com/ijl/orjson) library.
1111

12+
> [!NOTE]
13+
> All Serializers have omit_none=True parameter that is applied recursively. Thus, all None values are excluded from output.
14+
> This is expected behaviour and does not break anything in protocol.
15+
1216
### Updating direct usage of Pydantic based Airbyte Protocol Models
1317

1418
If the connector uses Pydantic based Airbyte Protocol Models, the code will need to be updated to reflect the changes `pydantic`.
1519
It is recommended to import protocol classes not directly by `import airbyte_protocol` statement, but from `airbyte_cdk.models` package.
16-
It is also recommended to use `Serializers` from `airbyte_cdk.models` to manipulate the data or convert to/from JSON.
20+
It is also recommended to use *-`Serializer` from `airbyte_cdk.models` to manipulate the data or convert to/from JSON, e.g.
21+
```python3
22+
# Before (pydantic model message serialization)
23+
AirbyteMessage().model_dump_json()
24+
25+
# After (dataclass model serialization)
26+
orjson.dumps(AirbyteMessageSerializer.dump(AirbyteMessage())).decode()
27+
28+
```
1729

1830
### Updating third-party libraries
1931

0 commit comments

Comments
 (0)