Metadata-Version: 2.5
Name: o41-metrics-duckdb
Version: 0.5.3
Summary: DuckDB extension that attaches 041 Metrics as a database
License-Expression: Apache-2.0
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: duckdb==2.0.0
Description-Content-Type: text/markdown

# o41-metrics-duckdb

DuckDB extension that attaches [041 Metrics](https://metrics.041.io/) as a
database, bundled per platform with a `load()` helper.

Install with `uv add o41-metrics-duckdb`. Upgrade with
`uv add -U o41-metrics-duckdb` or `pip install -U o41-metrics-duckdb`, then
restart Python. SQL `INSTALL` and `FORCE INSTALL` do not replace the binary
bundled in this wheel. Release builds warn on stderr at the first ATTACH when a
newer version is available. Set `O41_METRICS_DISABLE_UPDATE_CHECK=1` to disable
the check.

```python
import duckdb
import o41_metrics_duckdb

con = duckdb.connect(config={"allow_unsigned_extensions": "true"})
o41_metrics_duckdb.load(con)
con.execute("CREATE SECRET o41 (TYPE o41_metrics, API_KEY 'ak_...')")
con.execute(
    "ATTACH 'metrics.041.io' AS m (TYPE o41_metrics)"
)
print(con.sql("SELECT folder_id, path FROM m.folders ORDER BY path"))
print(con.sql("SELECT slug, status FROM m.experiments WHERE folder_id = '019e...'"))
```

Give `experiments` a selector on `id`, `slug` or `folder_id`: without one, a
filter on `status`, a sort or `slug LIKE '%...%'` reads the record of every
experiment in the organization.

The wheel pins the exact DuckDB release the extension was built for. The
extension is not signed by DuckDB, so the connection has to allow unsigned
extensions before `load()`.

Persistent caching defaults to `~/.o41-metrics/duckdb-cache`. Set `CACHE_DIR` in
`ATTACH` to use another directory, or `CACHE false` to disable disk caching.

The SQL surface, selector rules, and cache behaviour are documented at
https://metrics.041.io/docs.
