> ## Documentation Index
> Fetch the complete documentation index at: https://jmail.world/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# DuckDB / SQL

> Query Parquet files directly over HTTP with SQL

[DuckDB](https://duckdb.org/) can query Parquet files directly over HTTP with zero download or setup. This is the fastest way to explore the data interactively.

## Setup

Install DuckDB, then query directly:

```bash theme={null}
duckdb
```

```sql theme={null}
SELECT sender, COUNT(*) as n
FROM read_parquet('https://data.jmail.world/v1/emails-slim.parquet')
GROUP BY sender ORDER BY n DESC LIMIT 20;
```

## Example Queries

### <img src="https://mintcdn.com/jmail/F-FAi3RZzojcIyie/images/jmail-app.png?fit=max&auto=format&n=F-FAi3RZzojcIyie&q=85&s=3d45d0246f3c69c7024d9a467fcfad28" alt="" style={{ width: '20px', display: 'inline', verticalAlign: 'middle', marginRight: '6px' }} width="207" height="207" data-path="images/jmail-app.png" /> Count emails by sender

```sql theme={null}
SELECT sender, COUNT(*) as n
FROM read_parquet('https://data.jmail.world/v1/emails-slim.parquet')
GROUP BY sender ORDER BY n DESC LIMIT 20;
```

### <img src="https://mintcdn.com/jmail/F-FAi3RZzojcIyie/images/jmail-app.png?fit=max&auto=format&n=F-FAi3RZzojcIyie&q=85&s=3d45d0246f3c69c7024d9a467fcfad28" alt="" style={{ width: '20px', display: 'inline', verticalAlign: 'middle', marginRight: '6px' }} width="207" height="207" data-path="images/jmail-app.png" /> Emails sent by Epstein

```sql theme={null}
SELECT subject, sent_at, to_recipients
FROM read_parquet('https://data.jmail.world/v1/emails-slim.parquet')
WHERE epstein_is_sender = true
ORDER BY sent_at DESC LIMIT 20;
```

### <img src="https://mintcdn.com/jmail/F-FAi3RZzojcIyie/images/jdrive.png?fit=max&auto=format&n=F-FAi3RZzojcIyie&q=85&s=fbe04f350a6febb5b8e050cba1003c2c" alt="" style={{ width: '20px', display: 'inline', verticalAlign: 'middle', marginRight: '6px' }} width="200" height="160" data-path="images/jdrive.png" /> Search documents

```sql theme={null}
SELECT original_filename, document_description, page_count
FROM read_parquet('https://data.jmail.world/v1/documents.parquet')
WHERE document_description ILIKE '%flight%'
LIMIT 20;
```

### <img src="https://mintcdn.com/jmail/F-FAi3RZzojcIyie/images/jphotos.png?fit=max&auto=format&n=F-FAi3RZzojcIyie&q=85&s=e9f59aaa9fa1ebb967916b9d576f6018" alt="" style={{ width: '20px', display: 'inline', verticalAlign: 'middle', marginRight: '6px' }} width="200" height="160" data-path="images/jphotos.png" /> Join photos with people

```sql theme={null}
SELECT p.name, COUNT(*) as appearances
FROM read_parquet('https://data.jmail.world/v1/photo_faces.parquet') pf
JOIN read_parquet('https://data.jmail.world/v1/people.parquet') p
  ON pf.person_id = p.id
GROUP BY p.name ORDER BY appearances DESC;
```

### Star counts by entity type

```sql theme={null}
SELECT entity_type, SUM(count) as total_stars
FROM read_parquet('https://data.jmail.world/v1/star_counts.parquet')
GROUP BY entity_type ORDER BY total_stars DESC;
```

## Using with Polars

[Polars](https://pola.rs/) can also read Parquet over HTTP:

```python theme={null}
import polars as pl

df = pl.read_parquet("https://data.jmail.world/v1/emails-slim.parquet")
print(df.group_by("sender").len().sort("len", descending=True).head(20))
```

## Using with Pandas

```python theme={null}
import pandas as pd

df = pd.read_parquet("https://data.jmail.world/v1/emails-slim.parquet")
print(df.groupby("sender").size().sort_values(ascending=False).head(20))
```
