Python client (datap-rs-client)¶
A standalone Python client for a running DataPress server, backed by the native
datapress-client Rust crate via PyO3. Requests are plain Python
dicts; responses come back as dicts. Structured queries can optionally be
decoded into a pyarrow.Table.
Two Python clients
This is the standalone package (datap-rs-client), independent of the
server. If you already use the embedded datap-rs wheel — which can also
run a server — its bundled stdlib client is documented under
Python → Client. Use datap-rs-client when you only
need to talk to a server and want the fast Rust transport.
Install¶
uv pip install datap-rs-client # core
uv pip install datap-rs-client[arrow] # + pyarrow for query_arrow()
Wheels are published for Linux (x86_64/aarch64), macOS (arm64), and Windows (x86_64) against CPython 3.9+ (abi3).
Usage¶
from datap_rs_client import DataPressClient
client = DataPressClient("http://127.0.0.1:8000")
client.datasets()
# ['accidents']
client.count("accidents", predicates=[{"col": "Severity", "op": "gte", "val": 3}])
# 123456
rows = client.query(
"accidents",
columns=["State", "Severity"],
predicates=[{"col": "Severity", "op": "gte", "val": 3}],
page_size=1000,
)
rows["page"], len(rows["data"])
# (1, 1000)
# Arrow (requires the [arrow] extra)
table = client.query_arrow("accidents", columns=["State", "Severity"], page_size=100_000)
table.num_rows
Authentication¶
client = DataPressClient(
"http://127.0.0.1:8000",
bearer_token="…", # servers with auth enabled
admin_token="…", # required by reload()
)
SQL¶
DataFrames¶
query_arrow(...) returns a pyarrow.Table (install the [arrow] extra).
Arrow is the zero-copy interchange format for every popular dataframe library,
so a single query feeds them all:
table = client.query_arrow(
"accidents",
columns=["State", "Severity"],
predicates=[{"col": "Severity", "op": "gte", "val": 3}],
page_size=1_000_000,
)