Metadata-Version: 2.3
Name: statql
Version: 0.1.2
Summary: Approximate, streaming SQL engine
License: Apache-2.0
Author: liel
Author-email: liellahat@gmail.com
Requires-Python: >=3.12,<4.0
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: duckdb (>=1.2.2,<2.0.0)
Requires-Dist: pandas (>=2.2.3,<3.0.0)
Requires-Dist: platformdirs (>=4.3.7,<5.0.0)
Requires-Dist: psycopg[binary] (>=3.2.6,<4.0.0)
Requires-Dist: pydantic (>=2.11.3,<3.0.0)
Requires-Dist: redis (>=5.2.1,<6.0.0)
Requires-Dist: sqlglot (>=26.13.0,<27.0.0)
Requires-Dist: streamlit (>=1.44.1,<2.0.0)
Requires-Dist: streamlit-code-editor (>=0.1.22,<0.2.0)
Description-Content-Type: text/markdown

# 📊 StatQL

**StatQL** is a desktop‑first SQL engine that streams **fast, *approximate* answers** from your data sources—*without spinning up a server*.

*Initial release ships with connectors for **PostgreSQL**, **Redis** (α quality) and the local **Filesystem**.  More catalogs—cloud object storage, OLAP warehouses, REST APIs—are on the roadmap.*

---

## Quick start

To launch StatQL, install it and start up the local server:

```bash
pip install statql
python -m statql            # launches the Streamlit server
```

Then in your browser, navigate to http://localhost:8501

Integrate your data sources in the `Integrations` page, then start running your queries!

---

## Usage examples

> StatQL emits a fresh result table every 0.5 – 1 s.  Each numeric cell is formatted as `value ± error`, where *error* is the absolute 95 % confidence‑interval half‑width.  As more of the population is sampled, the estimates tighten.

### 1️⃣ Row count per order status (single table)
```sql
SELECT l_linestatus, COUNT() AS rows
FROM pg.local.tpch.public.lineitem
GROUP BY l_linestatus;
```
| l_linestatus | rows |
|--------------|---------------------|
| F | 3 172 481 ± 46 892.7 |
| O | 3 181 633 ± 46 744.2 |

### 2️⃣ Total PNG footprint in `/data/images` (filesystem)
```sql
SELECT divide(SUM(size), 1_073_741_824) AS gib
FROM fs.media_fs.entries
WHERE get_file_ext(path) = 'png';
```
| gib |
|-----------|
| 118.6 ± 5.3 |

### 3️⃣ Row counts across *all* databases in a cluster (wildcards)
```sql
SELECT @db, COUNT() AS rows
FROM pg.us-cluster-4.?.public.lineitem
GROUP BY @db
ORDER BY rows DESC;
```
| @db | rows |
|------|-----------------|
| sales | 12 945 002 ± 99 811.4 |
| hr    |  6 088 551 ± 74 225.9 |
| …     | … |

---

👉 [**Full docs → docs/index.md**](docs/index.md)

