# SQLTools uses the engine you pass and reports failed reads

> Agno's SQLTools now keeps a db_engine you pass, even alongside connection fields, and run_sql_query returns the error when a row fetch fails.

- Published: 2026-11-17
- Author: JiMyung Lee
- Categories: Changelog
- Canonical: https://www.agno.com/blog/sqltools-uses-the-engine-you-pass-and-reports-failed-reads
- Markdown: https://www.agno.com/blog/sqltools-uses-the-engine-you-pass-and-reports-failed-reads.md

Agno's `SQLTools` now always uses the `db_engine` you pass, even when you also give connection fields. Before, passing `user`, `password`, `host`, `port` and `dialect` replaced the engine, so the agent queried whatever database those fields pointed at, with no warning. This call now keeps `engine`:

```python
SQLTools(db_engine=engine, user="agent", password="secret", host="db.internal", port=5432, dialect="postgresql+psycopg")
```

We built that call on both releases with a SQLite engine and printed the URL SQLTools kept:

```text
Before: engine in use: postgresql+psycopg://agent:***@db.internal:5432
Now:    engine in use: sqlite:////.../shop.db
```

`run_sql_query` also hid errors raised while reading rows. A SQLite query whose second row overflows in `abs()` fails during the fetch, and earlier releases answered with an empty list:

```text
Before: run_sql_query: []
Now:    run_sql_query: Error running query: (sqlite3.OperationalError) integer overflow
```

The agent now sees the real database error and can fix the query or tell the user.

See the [cookbook](https://github.com/agno-agi/agno/blob/main/cookbook/91_tools/sql_tools.py), and learn more about [SQLTools](https://docs.agno.com/tools/toolkits/database/sql) in the documentation.
