Universal SQL client for querying many databases with psql-style commands, scripts, and cross-database copy.
$brew install xo/xo/usql
Agent Compatibility
JSON Output
Agent Skill
MCP Support
AI Analysis
usql is a psql-inspired database shell that talks to many SQL backends through Go SQL drivers and dburl-style DSNs. It works as both an interactive client and a scriptable query runner when you need one command surface across heterogeneous databases.
What It Enables
- Run ad hoc queries or SQL files against PostgreSQL, MySQL, SQLite, SQL Server, Oracle, and many other supported backends from one CLI.
- Inspect schemas, tables, functions, indexes, and connection metadata with psql-style meta commands instead of learning each database's native client.
- Copy query results between databases, or import CSV-backed data into a destination table, with
\copyand dburl DSNs.
Agent Fit
-c,-f,--no-init,--no-password, and-qgive agents a workable non-interactive path once DSNs and credentials are already known.-Jenables JSON formatting for query results, but connection messages, errors, and some meta-command flows still come back as plain text.- Best for workflows that already know the target database and query shape; available drivers and metadata behavior vary by build tags and backend.
Caveats
- Driver coverage depends on how the binary was built: plain
go installincludes base drivers, while release and Homebrew builds include more. \copyis not a drop-in clone ofpsql's version and does not perform datatype conversion, so cross-database transfers may need explicit casts.