wal2json is a PostgreSQL output plugin designed for logical decoding. It converts logical decoding tuples (INSERT, UPDATE, DELETE) into JSON objects, making database changes easily consumable. It supports two formats: version 1 (JSON object per transaction) and version 2 (JSON object per tuple). This allows for flexible consumption of database changes via streaming protocols or a SQL API.
wal2json offers detailed information about database changes including transaction timestamps, schema details, data types, and even position within tables. It provides granular control over included information via configurable parameters, allowing users to tailor output to their specific needs. The plugin supports various filtering and inclusion options for messages and tables. It includes functionality to emit transactional messages for epochs and also rollback messages.
- JSON Output: Streams changes as JSON objects for easy parsing and integration with other systems.
- Flexible Formats: Supports two JSON output formats (version 1 and version 2) catering to different use cases.
- Configurable Parameters: Fine-grained control over included information like timestamps, schemas, data types, and more.
- Filtering & Inclusion: Ability to filter changes based on origins, tables, and messages.
- Support for Transactional Messages: Provides the ability to signal the beginning and end of transactions.
wal2json is a stable and well-maintained plugin with a history of ongoing development. Active issue tracking and regular releases indicate continued support and bug fixes. The documentation is comprehensive and provides clear guidance on installation, configuration and use.
wal2json benefits developers, data pipelines, and monitoring systems by providing a standardized and structured way to access PostgreSQL changes. It's valuable for building real-time data analysis, change data capture (CDC) systems, and auditing tools. It simplifies consumption of database events compared to traditional log parsing approaches.
