Skip to main content

A convenience wrapper around PyIceberg for simplified data loading into Apache Iceberg tables

Project description

iceberg-loader

A convenience wrapper around PyIceberg that simplifies data loading into Apache Iceberg tables. PyArrow-first, handles messy JSON, schema evolution, idempotent replace, upsert, batching, and streaming out of the box.

PyPI - Version PyPI - Python Version PyPI - Downloads Coverage CI License: MIT

Status: Actively developed and under testing. PRs are welcome!
Currently tested against Hive Metastore; REST Catalog support is planned.

Why iceberg-loader?

  • Messy JSON friendly: auto-serializes dict/list/mixed fields to strings so writes don't fail.
  • Schema evolution: add columns on the fly (opt-in), preserves field IDs.
  • Safe writes: append/overwrite, idempotent replace via replace_filter, upsert.
  • Stream friendly: commit intervals, batches, IPC streams.
  • Single config: LoaderConfig sets defaults; override per-call if needed.

Install

pip install "iceberg-loader[all]"

Or with uv:

uv pip install "iceberg-loader[all]"

Quickstart

import pyarrow as pa
from pyiceberg.catalog import load_catalog
from iceberg_loader import LoaderConfig, load_data_to_iceberg, create_arrow_table_from_data

catalog = load_catalog("default")
table_id = ("default", "comparison_complex_json")

data = [
    {"id": 1, "complex_field": {"a": 1, "b": "nested"}},
    {"id": 2, "complex_field": {"a": 2, "b": "another", "c": [1, 2]}},
    {"id": 3, "complex_field": [1, 2, 3]},
]

arrow_table = create_arrow_table_from_data(data)

config = LoaderConfig(write_mode="append", partition_col="signup_date", schema_evolution=True)
load_data_to_iceberg(arrow_table, table_id, catalog, config=config)

Documentation

Full usage guide, API reference, and examples: docs or run mkdocs serve locally. For runnable demos see docs/examples.md; to try locally, cd examples && docker-compose up -d.

Contributing

We welcome contributions! See CONTRIBUTING.md for setup, coding style, and PR guidelines.

hatch run lint
hatch run test

Contributors

Thanks to all contributors who have helped make this project better!

Made with contrib.rocks.

License

iceberg-loader is distributed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iceberg_loader-0.0.6.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iceberg_loader-0.0.6-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file iceberg_loader-0.0.6.tar.gz.

File metadata

  • Download URL: iceberg_loader-0.0.6.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for iceberg_loader-0.0.6.tar.gz
Algorithm Hash digest
SHA256 2d594f6ec34210431785a3500d69e7c0fc8966d035ea6f701e6c9dc7e0049e0f
MD5 f675e4212e244b3a4159812cf2686a59
BLAKE2b-256 931edea2928bb3ebeaf3c326cd259ad86eb06c744d34b144b17dcd80319ced01

See more details on using hashes here.

File details

Details for the file iceberg_loader-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: iceberg_loader-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for iceberg_loader-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c81f14415cc844b1d12257a43d8a6005ab4cd9125f858bae2b10e0707491d37f
MD5 f5f191489e37c63c05afff686ce3d254
BLAKE2b-256 a1d0cd41e3fc80a16bd0845a55fd1db49dc4daef1cac5fd993bb47fabd7a0644

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page