tree: c7ece47576744c6e25e8976ad841d9b747d2bd09
  1. python/
  2. src/
  3. tests/
  4. .gitignore
  5. Cargo.toml
  6. DEPENDENCIES.rust.tsv
  7. LICENSE
  8. Makefile
  9. NOTICE
  10. project-description.md
  11. pyproject.toml
  12. README.md
bindings/python/README.md

PyPaimon Rust

This project builds the Rust-powered core for PyPaimon while also providing DataFusion integration for querying Paimon tables.

Usage

import pyarrow as pa
from pypaimon_rust.datafusion import SQLContext

# Create a SQL context and register a Paimon catalog
ctx = SQLContext()
ctx.register_catalog("paimon", {"warehouse": "/tmp/paimon-warehouse"})

# Create a table and insert data
ctx.sql("CREATE SCHEMA paimon.my_db")
ctx.sql("CREATE TABLE paimon.my_db.users (id INT, name STRING, PRIMARY KEY (id))")
ctx.sql("INSERT INTO paimon.my_db.users VALUES (1, 'alice'), (2, 'bob')")

# Query data
batches = ctx.sql("SELECT id, name FROM paimon.my_db.users ORDER BY id")

# Register a temporary table from a PyArrow RecordBatch
batch = pa.record_batch([[1, 2], ["alice", "bob"]], names=["id", "name"])
ctx.register_batch("paimon.default.my_temp", batch)
batches = ctx.sql("SELECT * FROM paimon.default.my_temp")

# Drop it via SQL when no longer needed
ctx.sql("DROP TEMPORARY TABLE paimon.default.my_temp")

For the full SQL reference, see the SQL Integration docs.

Setup

Install uv:

pip install uv

Set up the development environment:

make install

Build

make build

Test

Python integration tests expect the shared Paimon test warehouse to be prepared first from the repository root:

make docker-up
cd bindings/python
make test