Mubin Attar

Note

One agent, three SQL dialects

  • ~1 min read
  • #sql#agents

DBWhisper answers questions against Postgres, MySQL, and SQL Server. The lazy way is to emit one generic SQL string and hope each engine accepts it — they don't. Date functions, identifier quoting, and pagination all differ.

So generation carries per-dialect directives: the model is told which dialect it's targeting and emits date_trunc(...) for Postgres and the right equivalent elsewhere. Execution runs through SQLAlchemy 2.0 (plus ODBC for SQL Server), and the same fail-closed validator gates every statement regardless of dialect.

The dialect is a parameter, not a fork in the codebase — one agent, three engines. See the DBWhisper case study.

New writing, occasionally.

The odd essay or note when I ship something worth reading — no cadence, no spam, unsubscribe in one click.

Enter your email address, then select Subscribe.