Airbyte Protocol Models

raw JSON →
0.18.0 verified Fri May 01 auth: no python

Declares the Airbyte Protocol as Python models based on JSON Schema. Contains pydantic models for Airbyte messages, configured as a Python package. Latest stable version is 0.18.0 (PyPI), with 0.19.0 released on GitHub. Release cadence is irregular, roughly every 1-2 months.

pip install airbyte-protocol-models
error ModuleNotFoundError: No module named 'airbyte_protocol'
cause Package not installed or incorrect environment.
fix
Run 'pip install airbyte-protocol-models'.
error ImportError: cannot import name 'AirbyteMessage' from 'airbyte_protocol'
cause Importing directly from top-level package instead of submodule.
fix
Use 'from airbyte_protocol.models import AirbyteMessage'.
error AttributeError: module 'airbyte_protocol.models' has no attribute 'AirbyteCatalog'
cause AirbyteCatalog was removed in v0.17.0 models.
fix
Use ConfiguredAirbyteCatalog or check the latest model definitions.
breaking V1 models removed in v0.17.0. All protocol models are now under airbyte_protocol.models.
fix Replace imports from airbyte_protocol.v0 or airbyte_protocol.v1 with airbyte_protocol.models.
deprecated The 'schema' field in messages has been renamed to 'json_schema' in v0.16.0.
fix Use 'json_schema' instead of 'schema' in message payloads.
gotcha AirbyteRecordMessage.emitted_at is expected as an integer (milliseconds epoch).
fix Always provide emitted_at as int, e.g., round(time.time() * 1000).

Create and serialize an Airbyte record message.

from airbyte_protocol.models import AirbyteMessage, Type, AirbyteRecordMessage

# Create a record message
record = AirbyteRecordMessage(
    stream="my_stream",
    data={"id": 1, "name": "example"},
    emitted_at=1610000000000
)
msg = AirbyteMessage(type=Type.RECORD, record=record)
print(msg.json(indent=2))