Apache Avro Format
Description
Apache Avro is a data serialization system that provides rich data structures, compact binary format, and schema evolution. Avro files contain both the schema and data, making them self-describing. The format is widely used in big data ecosystems, particularly with Apache Hadoop and Kafka.
File Extensions
.avro- Apache Avro files
Implementation Details
Reading
The Avro implementation:
- Uses
avro-python3library - Reads Avro data files with embedded schema
- Supports schema evolution
- Converts Avro records to Python dictionaries
Writing
Writing is not currently supported for Avro format.
Key Features
- Schema evolution: Supports schema changes over time
- Compact binary: Efficient storage format
- Self-describing: Schema embedded in file
- Type preservation: Maintains data types
- Flat data: Designed for tabular/flat data structures
Usage
from iterable import open_iterable
# Basic reading
source = open_iterable('data.avro')
for row in source:
print(row)
source.close()
Parameters
No specific parameters required for reading.
Limitations
- Read-only: Avro format does not support writing
- avro-python3 dependency: Requires
avro-python3package - Flat data only: Designed for tabular data structures
- Schema complexity: Complex schemas may require manual handling
- Binary format: Not human-readable
Compression Support
Avro files can be compressed with all supported codecs:
- GZip (
.avro.gz) - BZip2 (
.avro.bz2) - LZMA (
.avro.xz) - LZ4 (
.avro.lz4) - ZIP (
.avro.zip) - Brotli (
.avro.br) - ZStandard (
.avro.zst)
Note: Avro also has built-in compression (null, deflate, snappy), which is separate from file-level compression.
Use Cases
- Big data processing: Common in Hadoop ecosystems
- Data pipelines: Schema evolution in streaming systems
- Kafka: Message serialization format
- Data warehousing: Efficient storage for analytics
Related Formats
- Parquet - Another columnar format
- ORC - Similar columnar format
- Protocol Buffers - Another serialization format