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

# SQL helpers

> toradb.sql module

## `sql(db, statement)`

Alias for `db.sql(statement)`.

## `sql_stream(db, statement, batch_size=128)`

Iterate retrieval pages:

```python theme={null}
from toradb.sql import sql_stream

for page in sql_stream(
    db,
    "SELECT id FROM docs SPARSE SEARCH body BM25('Tesla') LIMIT 100",
    batch_size=32,
):
    print(page.to_pandas())
```

Restrictions match `Database.sql_stream`: retrieval `SELECT` only; no `GROUP BY` or `EXPLAIN`.

See [SQL guide](/guides/sql) and [SQL reference](/api-reference/sql/overview).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.