Metadata-Version: 2.5
Name: rho-store
Version: 1.0.0
Summary: Durable, versioned, shareable tables for AI agents and the scripts around them
Project-URL: Homepage, https://rho.store
Project-URL: Documentation, https://rho.store/docs/guides/python-sdk/
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Database
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Requires-Dist: pyarrow>=15
Provides-Extra: pandas
Requires-Dist: pandas>=2.0; extra == 'pandas'
Provides-Extra: polars
Requires-Dist: polars>=1.0; extra == 'polars'
Description-Content-Type: text/markdown

# rho-store

Durable, versioned, shareable tables for AI agents and the scripts around them. Every write makes a new version, so
nothing written is ever lost; any version can be read again or restored.

```bash
pip install "rho-store[pandas]"   # or [polars]
export RHO_API_KEY=rho_sk_…       # make one in the rho app: API tokens, in the sidebar
```

```python
import rho

rho.put(df, "research/competitors")  # a new version; columns keep their types
rho.put(new, "research/competitors", mode="upsert", key="company", message="weekly refresh")
df = rho.get("research/competitors")  # latest; version=3 for an earlier one
df = rho.query('SELECT category, count(*) AS n FROM "research/competitors" GROUP BY 1')
rho.history("research/competitors")  # who wrote what, when
rho.restore("research/competitors", version=3)  # as a new version
url = rho.share("research/competitors")  # makes it public: a link anyone can open
```

`put` takes a pandas or Polars DataFrame, an Arrow table or a list of dicts. `get` and `query` give pandas by
default; pass `as_="polars"`, `"arrow"` or `"rows"`. Data travels as Parquet, never JSON, so types come back as they
went: whole numbers stay whole (nullable ones become `Int64`), timestamps keep nanoseconds, decimals their scale.
A few things rho keeps differently: a time zone becomes UTC (the same instant), a category becomes text, and a
DataFrame's default index isn't kept (a named one becomes a column). Durations are turned down with a hint.

Modes: `replace` (the default) makes the data the table, `append` adds rows, `upsert` updates rows whose `key`
matches and adds the rest, `create` fails if the table exists. Pass `run="nightly-2026-10-29"` to label the job.

## Async

```python
async with rho.AsyncClient() as client:
    await client.put(df, "runs/evals", mode="append", run=run_id)
    df = await client.query('SELECT model, avg(score) FROM "runs/evals" GROUP BY 1')
```

`rho.Client` and `rho.AsyncClient` have the same methods; pass `api_key=` and `url=` to choose them yourself
(`RHO_URL` points the module functions at another server, e.g. `http://localhost:6061`).

Anything rho decides about data it's given comes as a `rho.RhoWarning`; the write is made. Column names are
compared without case, so `A` and `a` in one frame are turned down. Errors are `rho.RhoError`, with `kind` (`not_found`, `exists`, `schema_conflict`, …) and a `hint` saying what to do.
