db_query
Execute a read-only SELECT query on your database and retrieve results as a list of dictionaries. Returns row count and connection details with write protection.
Instructions
Execute a read-only SELECT query and return rows as a list of dicts.
All queries run inside an immediately-rolled-back transaction — write
statements are blocked both statically and at the transaction level.
Call db_get_schema first if you are unfamiliar with the table structure.
Args:
sql: SELECT query to execute. No INSERT/UPDATE/DELETE allowed.
connection: Connection name (e.g. "orders.prod"). Defaults to first defined.
max_rows: Maximum rows to return (default 500). Set lower for large tables.
Returns:
{rows, row_count, connection, database, truncated}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | ||
| connection | No | ||
| max_rows | No |