Skip to main content

PyArrow

SigilYX can produce PyArrow Tables directly. This is useful if you're working in the Arrow ecosystem - for example, writing to Parquet, feeding data into DuckDB, or bridging to other Arrow-compatible tools.

Installation

pip install sigilyx[arrow]

Reading

import sigilyx as yx

table = yx.read_yxdb_arrow("data.yxdb")
print(type(table)) # <class 'pyarrow.lib.Table'>
print(table.schema)

The Arrow Table is built from the same Arrow arrays that the Rust reader produces. This is a near-zero-cost conversion.

Writing

import sigilyx as yx
import pyarrow as pa

# Write a PyArrow Table to YXDB
table = pa.table({"id": [1, 2, 3], "name": ["a", "b", "c"]})
yx.write_yxdb_arrow("output.yxdb", table)

Type Mapping

Arrow TypeYXDB Type
boolBoolean
int16Int16
int32Int32
int64Int64
float32Float
float64Double
decimal128FixedDecimal
utf8String / WString
large_utf8V_String / V_WString
date32Date
timestamp[us]DateTime
time64[ns]Time
binary / large_binaryBlob

Common Patterns

YXDB to Parquet via Arrow

import sigilyx as yx
import pyarrow.parquet as pq

table = yx.read_yxdb_arrow("data.yxdb")
pq.write_table(table, "data.parquet")

Query YXDB with DuckDB

import sigilyx as yx
import duckdb

table = yx.read_yxdb_arrow("data.yxdb")

result = duckdb.sql("""
SELECT region, SUM(revenue) as total
FROM table
GROUP BY region
ORDER BY total DESC
""").arrow()

Stream Arrow RecordBatches

If you need batch-level control, you can use read_yxdb_batches() and convert each batch:

import sigilyx as yx

for polars_batch in yx.read_yxdb_batches("data.yxdb", batch_size=50_000):
arrow_batch = polars_batch.to_arrow()
# Process each batch individually

IPC / Feather round-trip

import sigilyx as yx
import pyarrow as pa
import pyarrow.feather as feather

table = yx.read_yxdb_arrow("data.yxdb")
feather.write_feather(table, "data.feather")

# Read back
table2 = feather.read_table("data.feather")
yx.write_yxdb_arrow("roundtrip.yxdb", table2)