{"id":4414,"library":"airbyte-protocol-models-dataclasses","title":"Airbyte Protocol Dataclass Models","description":"This library declares the Airbyte Protocol using Python Dataclasses. It is designed for scenarios where speed and memory usage are critical, offering less performance overhead compared to Pydantic models. The library is actively maintained with frequent updates, typically released monthly, in alignment with the broader Airbyte platform. The current version is 0.18.0.","status":"active","version":"0.18.0","language":"en","source_language":"en","source_url":"https://github.com/airbytehq/airbyte-protocol","tags":["data integration","ETL","protocol","dataclasses","airbyte"],"install":[{"cmd":"pip install airbyte-protocol-models-dataclasses","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"note":"Airbyte Protocol models are typically namespaced under `v0.models` within the package, reflecting the current stable protocol version.","symbol":"AirbyteMessage","correct":"from airbyte_protocol_models_dataclasses.v0.models import AirbyteMessage"},{"symbol":"AirbyteRecordMessage","correct":"from airbyte_protocol_models_dataclasses.v0.models import AirbyteRecordMessage"},{"symbol":"Type","correct":"from airbyte_protocol_models_dataclasses.v0.models import Type"}],"quickstart":{"code":"import json\nfrom dataclasses import asdict\nfrom datetime import datetime\nfrom airbyte_protocol_models_dataclasses.v0.models import AirbyteMessage, AirbyteRecordMessage, Type\n\n# Create an AirbyteRecordMessage representing a data record\nrecord_data = {\n    \"id\": 1,\n    \"name\": \"Test User\",\n    \"email\": \"test.user@example.com\",\n    \"created_at\": datetime.now().isoformat()\n}\nrecord_message = AirbyteRecordMessage(\n    stream=\"users\",\n    data=record_data,\n    emitted_at=int(datetime.now().timestamp() * 1000),\n)\n\n# Wrap the record in a top-level AirbyteMessage\nairbyte_message = AirbyteMessage(\n    type=Type.RECORD,\n    record=record_message,\n)\n\n# Convert the dataclass instance to a dictionary and then to a JSON string\njson_output = json.dumps(asdict(airbyte_message), indent=2)\nprint(\"\\n--- Airbyte Record Message ---\")\nprint(json_output)\n\n# Example of creating an AirbyteStateMessage\nstate_data = {\"users_sync_progress\": {\"last_id\": 100, \"updated_at\": datetime.now().isoformat()}}\nstate_message = AirbyteMessage(\n    type=Type.STATE,\n    state=state_data,\n)\n\n# Serialize the state message\njson_state_output = json.dumps(asdict(state_message), indent=2)\nprint(\"\\n--- Airbyte State Message ---\")\nprint(json_state_output)","lang":"python","description":"This quickstart demonstrates how to construct basic Airbyte Protocol messages (Record and State) using the dataclass models. It shows how to create a `AirbyteRecordMessage` and `AirbyteStateMessage`, wrap them in a generic `AirbyteMessage`, and then serialize them to JSON format for inter-process communication, which is standard for the Airbyte Protocol. All fields are expected to be correctly typed according to the protocol's JSON schema."},"warnings":[{"fix":"Migrate all protocol model usage to the `v0` namespace, e.g., `from airbyte_protocol_models_dataclasses.v0.models import ...`.","message":"Protocol V1 models have been removed starting from version 0.17.0. Code relying on `v1` namespaces or structures will break.","severity":"breaking","affected_versions":">=0.17.0"},{"fix":"Update any code that accesses or creates catalog configurations to use the `json-schema` field name instead of `schema`.","message":"The field name 'schema' was renamed to 'json-schema' in version 0.16.0. This affects how catalog objects are structured and accessed.","severity":"breaking","affected_versions":">=0.16.0"},{"fix":"Implement explicit type checking and validation logic if strict runtime validation is required, or consider using `airbyte-protocol-models-pdv2` if Pydantic's features are essential and the performance trade-off is acceptable.","message":"This library uses Python's native dataclasses for protocol models, explicitly to reduce performance overhead compared to Pydantic. Users accustomed to Pydantic's features (e.g., automatic type coercion, runtime validation, custom validators) will find these are not natively available.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}