Discover MCPs & agents
Loading MCPs and agents…
Loading MCPs and agents…
A database client for the terminal: MySQL, MariaDB, PostgreSQL, SQLite, and hosted ones like Neon, Supabase and PlanetScale. Shows you the SQL, gives your AI agent read-only access over MCP, one binary, no PHP needed.
Jump to setup instructionsNo tool list is on record. This does not mean the server has no tools. Tools were not run.
No setup evidence yet No matching config or report on record. This does not mean the server is incompatible.
Same catalog task: Manage databases & data.
MCP server for interacting with MySQL databases with write operations support
Same catalog task: Manage databases & data.
MCP server for DBX — query databases from Claude Code, Cursor, and other AI agents
Same catalog task: Manage databases & data.
Enhanced PostgreSQL MCP server with read and write capabilities. Based on @modelcontextprotocol/server-postgres by Anthropic.
Fetched from the repository for this visit.

tql (pronounced TEE-kwuhl, like sequel) is a database client for the terminal, for MySQL, MariaDB, PostgreSQL, SQL Server and SQLite, and the hosted databases that speak their protocol. It is written in Rust and ships as one file.
The database is the part of the job you cannot see. Everything else is in the terminal already (the editor, the logs, the deploy) and then the schema is behind a window you have to go and find, in an application that costs money and knows nothing about the rest of your work.
tql is that window, in the terminal, and it is built around three things a GUI tends not to do:
order by appears.
Filter a column and the where appears, with its value bound, never glued in.
You learn the language by using the tool.tql query
commands, the MCP server and the interface all go through the same code, so
what your agent can see is what you can see. The agent's side only reads, and
every statement either of you runs lands in one shared history. An agent can
also put a statement in your SQL editor for you to read and run.d. Read-only connections refuse every write. Edits and deletions are
pending until you type :w.It is one binary, no configuration required to start, and it opens a SQLite file as happily as a Postgres server behind an SSH tunnel.
| Database | |
|---|---|
| MySQL and MariaDB | built in |
| PostgreSQL | built in |
| SQLite | built in, any .sqlite, .sqlite3 or .db file |
| SQL Server | built in, nothing else to install (below) |
| DuckDB | built in, any .duckdb file, schemas and all |
| libSQL and Turso | built in, a libsql:// URL and its auth token (below) |
| ClickHouse | built in, browse and query (below) |
| Snowflake | built in, browse and query with an access token, a key pair or browser SSO (below) |
| Redis and Valkey | built in, a key browser of their own (below) |
A hosted database that speaks the MySQL or PostgreSQL protocol connects the same way, with a connection string or the connection form, over TLS and, if it needs one, an SSH tunnel:
tql is developed against MySQL 9 locally and MySQL 8.4 on Laravel Cloud. The rest speak the same protocol and should behave the same; if one does not (some report their schema a little differently), open an issue and say which.
SQL Server is built in, like the others: there is no ODBC driver or OpenSSL to install, on macOS or Linux. It needs a server that speaks TLS 1.2 or newer, which is every SQL Server from 2016 on and the older ones that have had their TLS 1.2 update.
A connection is encrypted by default without checking the server's certificate,
which is what a local or self-signed SQL Server needs; ssl_mode verify-ca or
verify-full checks it, and disable turns encryption off.
A libSQL connection is a URL and an auth token: tql open "libsql://shop-you.turso.io?authToken=…", or the connection form's URL and
Auth token. tql speaks Turso's HTTP API, so a self-hosted sqld works too
(http://127.0.0.1:8080). Everything SQLite does works here, editing included.
A Redis or Valkey connection opens a key browser in place of the table list:
tql open redis://:password@host:6379/0, rediss:// for TLS, or the
connection form. Keys are read with SCAN in the background, never KEYS, and
folded into namespaces on :; / narrows them with a pattern such as user:*,
and b switches database.
Every type shows as itself: a string as text (JSON pretty-printed, binary as
hex), a hash as fields and values, a list, set or sorted set as rows, and a
stream as entries. e edits a value, a field, an item, a member or a score,
N adds one, and d marks one for removal; on the key list, N makes a key,
d deletes one, T sets its TTL and R renames it. Edits wait for :w, which
sends them all in one transaction, so either every one happens or none does. A
list item that moved since tql read it is not removed by mistake.
On Redis 7.4 and Valkey 9, a hash shows each field's TTL, and T on a field
sets or clears it. :log shows the server's recent slow commands, from
Valkey's command log or Redis's slow log.
s opens a command pane for anything else (HGETALL user:1, ZRANGE leaders 0 9 WITHSCORES); ctrl+r runs the line. On a read-only connection it runs only
commands the server says only read, and it never runs one that waits forever,
such as BLPOP or SUBSCRIBE.
ClickHouse connects over its HTTP interface, port 8123, or 8443 with an
ssl_mode set (clickhouses:// in a connection string). Databases switch with
b, and every type shows as itself: arrays, maps and tuples as JSON, and big
integers and decimals exactly. Tables are edited like any other, with one
difference: ClickHouse keys need not be unique, so before each change tql
counts the rows it would reach and changes nothing if that is more than the
rows you edited. The change then runs as a mutation that tql waits for, so
:w is done when it says so. A table with no key is matched on its values,
leaving out floats, maps, arrays and other values that do not compare
exactly. Key columns cannot be changed; ClickHouse does not allow it. The SQL
editor runs whatever the connection allows.
Snowflake connects over its SQL API with its account, the myorg-myaccount
part of your Snowflake URL, signing in one of four ways, chosen with Sign in
with in the connection form or authenticator in a connection string:
snowflake://user:token@myorg-myaccount/DATABASE?warehouse=WH&role=ROLE.RSA_PUBLIC_KEY:
snowflake://user@myorg-myaccount/DATABASE?authenticator=snowflake_jwt&private_key_path=~/.snowflake/rsa_key.p8.
An encrypted key's passphrase is saved as the connection's password. tql
reads PKCS#8 keys, encrypted or not, and unencrypted PKCS#1 keys.snowflake://myorg-myaccount/DATABASE?role=ROLE, or
authenticator=oauth_authorization_code. It is also what a connection with
no access token uses. See below.authenticator=externalbrowser. tql opens your identity provider (Okta,
Entra ID and the rest) directly and listens on 127.0.0.1 for it to come
back. This works on accounts without the built-in OAuth integration the
browser sign-in needs. The session is kept in tql's store, encrypted like a
saved password, and renewed without the browser for as long as Snowflake
allows, about four hours.Either browser sign-in is saved with the connection, so the next launch,
tql dump, tql export and the MCP server reuse it rather than opening a
browser each time. :sign-out on the connection list forgets the one saved
with the highlighted connection.
Warehouse and role fall back to the user's defaults, and with no schema set
tql browses PUBLIC. Tables, columns and keys come from SHOW commands,
which do not wake the warehouse. Dates, times, timestamps, variants and binary
show as Snowflake writes them, and declared primary and foreign keys link rows
even though Snowflake does not enforce them. Because it does not, tql edits a
row inside a transaction that commits only if exactly that one row changed: a
key that matches two rows changes neither, and tql says so. A table with no
primary key is edited too, matching the row on its values; floats, variants
and binary are left out of the match, since they do not compare exactly, and
if what is left fits more than one row the edit is rolled back the same way.
Writes wake the warehouse; browsing does not.
A token from a person rather than a service user needs a network policy, or an
authentication policy with pat_policy = (network_policy_evaluation = enforced_not_required), before Snowflake accepts it.
The browser sign-in opens the browser ($BROWSER if set) and waits up to
three minutes for you to sign in. It is renewed as it runs out, so the browser
opens again only when Snowflake stops renewing it; how long that takes is up
to your account's OAUTH_REFRESH_TOKEN_VALIDITY. This uses Snowflake
OAuth for local applications, which needs no setup unless your account does
not have the built-in SNOWFLAKE$LOCAL_APPLICATION integration yet
(show security integrations like 'SNOWFLAKE$LOCAL\_APPLICATION'). A role on
the connection is the role the sign-in asks for.
One file, no runtime to install. The binary has every database driver
built in, and on Linux it is statically linked, so it runs on any distribution.
On first run it creates ~/.config/tql/ and migrates its own store, so there is
nothing to set up.
Use your package manager if it is listed here: nothing runs but the package
itself, and it upgrades and removes tql like anything else. Installed any other
way, tql keeps itself up to date, see [updates].
brew install vheissulabs/tap/tql
brew upgrade tql # later, for a new release
Apple Silicon Macs, and Linux on x86_64 and ARM. It installs the same standalone binary, with no dependencies. Homebrew checks the binary against the checksum in the formula before it installs it.
Every release carries a .deb for each architecture, with no dependencies.
Download it from the latest release,
or with the GitHub CLI:
gh release download --repo VheissuLabs/tql --pattern '*_amd64.deb' # arm64: '*_arm64.deb'
sudo apt install ./tql_*_amd64.deb
Install a newer .deb the same way to upgrade; sudo apt remove tql takes it
off again.
The same again as an .rpm:
gh release download --repo VheissuLabs/tql --pattern '*.x86_64.rpm' # ARM: '*.aarch64.rpm'
sudo dnf install ./tql-*.x86_64.rpm
A newer .rpm upgrades it; sudo dnf remove tql removes it.
There is no apt or dnf repository yet, so apt upgrade and dnf upgrade do
not see new releases. tql --version says which one you have.
tql is not on the AUR yet, but the install script installs it as a pacman package:
curl -fsSL https://raw.githubusercontent.com/VheissuLabs/tql/main/install.sh | sh
On Arch it downloads the release's package, checks it against the release's
SHA256SUMS and hands it to sudo pacman -U, which asks before it installs, as
usual. pacman owns /usr/bin/tql from then on, and sudo pacman -R tql removes
it. There is no repository behind it, so pacman -Syu does not see new
releases: tql tells you when one is out, and running the script again upgrades
it. If an earlier run of the script left a loose tql in /usr/local/bin or
~/.local/bin, it is removed so it does not hide the package. A version
pinned with TQL_VERSION from before 0.17.1 has no package, so the script
installs the binary for it instead.
From 0.17.1 the package is also a release asset,
tql-<version>-1-x86_64.pkg.tar.zst (or aarch64), for sudo pacman -U by
hand, and releases after 0.7.0 carry a PKGBUILD for makepkg -si.
The releases carry tql-linux-x86_64, tql-linux-aarch64, and
tql-macos-aarch64 for Apple Silicon. Put the one for your machine anywhere on
your PATH:
gh release download --repo VheissuLabs/tql --pattern tql-macos-aarch64
chmod +x tql-macos-aarch64 && mv tql-macos-aarch64 /usr/local/bin/tql
Releases after 0.7.0 carry SHA256SUMS, the checksum of every file in the
release. Download it next to what you downloaded and check:
gh release download --repo VheissuLabs/tql --pattern SHA256SUMS
sha256sum --check --ignore-missing SHA256SUMS # macOS: shasum -a 256 --check --ignore-missing SHA256SUMS
OK beside your file means it is byte for byte what the release built.
curl -fsSL https://raw.githubusercontent.com/VheissuLabs/tql/main/install.sh | sh
It picks the build for your platform, puts it somewhere on your PATH
(/usr/local/bin if it can write there, ~/.local/bin if not) and tells you
where it went. TQL_BIN_DIR chooses the directory, TQL_VERSION=v0.4.1 pins a
version. On Arch it installs the pacman package instead, unless TQL_BIN_DIR
asks for the binary in a directory of your choosing.
Piping a script from the internet into a shell runs whatever it says, so if you would rather read it first, and you should, download it, read it, then run it:
curl -fsSLO https://raw.githubusercontent.com/VheissuLabs/tql/main/install.sh
less install.sh
sh install.sh
How the Homebrew formula and the packages are published is in docs/packaging.md.
tql was written in PHP up to 0.11. 0.12 is the same tql rewritten in Rust, and it moves over without you doing anything:
~/.config/tql/, passwords included, and adds any new settings to
config.toml with a notice.tql update or the automatic update brings it in, if you installed with
the install script or by hand. Homebrew, .deb, .rpm and PKGBUILD users
upgrade the usual way.tql.phar is gone. If you ran the phar, install one of the binaries
above instead; none of them needs PHP.Running tql with nothing after it opens the connection list, which is how you
will use it nearly all the time. The rest are for the things a full-screen
interface is the wrong shape for.
| Command | What it does |
|---|---|
tql | the interface: pick a connection and browse |
tql connect <connection> [--db=<database>] | open a saved connection by name, skipping the list; --db picks another database on the same server |
tql open <path-or-dsn> | open a database by path or connection string, saving it; tql connect takes these too |
tql export [connection] [table] | write rows out as re-importable SQL |
tql tableplus | bring your TablePlus connections over, groups and passwords too |
tql dump <connection> [tables…] | dump a database, schema and data, with mydumper or pg_dump |
tql load <dump-or-sql> <connection> | load a dump, or replay an export; tql import is the same |
tql sync <from> <to> | make one database a copy of another, a dump and a load in one step |
tql settings | change your settings on a screen, saved as you go |
tql new | open tql on a new connection form |
tql sql [connection] | open tql in the SQL editor; without a connection, tql asks |
tql history [connection] | open tql on the query history |
tql config | where the config file is; --tidy puts it back in order |
tql connections | list the saved connections |
tql tables <connection> | list a connection's tables |
tql describe <connection> <table> | a table's columns, types and primary key |
tql query <connection> "select …" | run a read-only query; - reads it from stdin |
tql mcp:start tql | run the MCP server on stdio, for an agent |
tql update | update to the latest release now; see [updates] |
tql -v | the version you have; -V and --version say the same |
tql open ~/Code/app/database/database.sqlite
tql open "mysql://root@127.0.0.1:3306/shop" --name="Shop" --tag=local
tql open "$DATABASE_URL" --peek # use it without saving it
tql connect 'mysql+ssh://forge@203.0.113.7/forge:secret@127.0.0.1?name=app&env=production'
The last form is the one TablePlus copies: the SSH server first, then the
database behind it. tql saves the tunnel with it, takes name as the name and
env as the tag, and leaves the SSH key to your agent and ~/.ssh/config.
open takes a SQLite path or a connection string, remembers it, and drops you
straight into it. Opening one you already have reuses that connection rather
than saving a second.
| Argument or flag | What it does |
|---|---|
<path-or-dsn> | a SQLite or DuckDB file, or a mysql://, pgsql://, postgres://, sqlsrv://, mssql://, libsql://, clickhouse://, snowflake://, redis:// or valkey:// string (clickhouses://, rediss:// and valkeys:// for TLS); mysql+ssh:// and the others with +ssh go through an SSH server first |
--name=<name> | what to call it in the connection list; on one already saved, a rename |
--tag=<tag> | what it is: production, staging, dev or local, which decides the color it wears; see Tags and read only |
--peek | open it without saving it |
From a TablePlus URL, tql takes name as the name and env as the tag
(production, staging, local, and development or testing as dev), and
ignores the rest, such as statusColor and safeModeLevel. Quote a connection
string: ? and & mean something to your shell. Use single quotes when the
password has a $, ! or backtick in it.
export asks for whatever you leave out (connection, database, table and where
to save), so tql export on its own is a four-question wizard, and
tql export prod orders --sql=./orders.sql is a script. See
Exporting.
Inside tql, :open, :update, :export (this table) and :export database
(every table) do the same from the command line or the ctrl+k palette, and :v
says which version you have. See docs/keys.md.
tql list shows those. tql runs its store's migrations for itself, so there is
no command for them. A debug build from a source checkout also shows
make:command, which writes the skeleton of a new command.
tql settings, or :settings and ctrl+k inside tql, opens every setting on one
screen, grouped under sections that fold. Change one and it takes effect at
once and is written to ~/.config/tql/config.toml straight away, that line and
nothing else, your comments kept. / finds a setting by name and x puts one
back to its default. The few that tql reads only as it starts, such as mouse,
say so.
There is nothing to configure to start. On first run tql writes
~/.config/tql/config.toml with every setting at its default and a comment
above each one, so the file is its own documentation. When a later version adds
a setting it is appended to your file on the next run (your values and your own
comments are left alone) and the status line tells you which ones arrived.
Defaults are built into tql and the file is merged over them, so a setting you never touch follows the application rather than freezing at the value it had the day you installed it. A file that cannot be parsed does not stop tql: it starts on the defaults and says so in the status line.
Everything belongs to a section. A key above the first [section] is read as a
key of no section and quietly does nothing, which is a mistake worth knowing
about, so tql notices and tells you.
docs/configuration.md is the same list with more said about each one.
[ui]| Key | Default | Meaning |
|---|---|---|
sql_position | "top" | where the SQL editor sits: "top" or "bottom" |
sql_always | false | keep the SQL editor on screen instead of only after s |
sql_height | 0 | rows it takes, 0 picks a third of the frame |
sql_editor | "simple" | how the SQL editor takes keys: "simple" or "vim", see the SQL editor |
sql_complete | true | offer tables, columns and keywords as you type in the SQL editor; tab or ↵ takes one |
sql_keyword_case | "match" | the case completion writes keywords in: "match" follows how you type (sel gives select, SEL gives SELECT), or always "upper" or "lower" |
row_style | "marker" | how the current row is shown: marker, dim-others, bold, inverse, underline |
top_margin | 0 | blank rows above the frame |
bottom_margin | 0 | blank rows below the frame |
left_margin | 0 | blank columns left of the frame |
right_margin | 0 | blank columns right of the frame |
sidebar_width | 24 | width of the tables pane |
time_zone | "UTC" | the zone ctrl+t and now() write in, such as America/Toronto |
modal_ring | true | ring a modal with a border as well as the box itself |
inspect_related | 10 | related rows to load into the row inspector, 0 turns it off |
export_path | "" | where exports go, empty uses the last folder you saved one in |
mouse | true | click, drag and scroll inside tql |
double_click_ms | 400 | how close two clicks must be to open the editor |
hotkey_bar | true | the row of keys under the frame; false gives the row to the frame, and ? and the palette still list every key |
status_seconds | 4 | how long a status message stays before it fades; 0 keeps it |
mouse_row_offset | 0 | subtract this from reported mouse rows |
mouse_column_offset | 0 | subtract this from reported mouse columns |
confirm_create_on_production | true | creating a database from the database list on a connection tagged production asks first |
The margins frame tql inside its window. A terminal or multiplexer that pads
one side more than the other can be evened out with left_margin or
right_margin. A click in a margin lands on nothing.
mouse_row_offset = 1 is the one to reach for inside a multiplexer whose tab
bar sits above the pane: without it every click lands a row out.
[theme]Colors are names, not hexes (dim, default, black, red, green,
yellow, blue, magenta, cyan, white, gray), so tql wears the palette
your terminal is already themed with.
| Key | Default | Meaning |
|---|---|---|
border | "dim" | a pane border that is not focused |
focus_border | "cyan" | the border of the pane you are in |
focus_title | "cyan" | its title |
cursor | "default" | the block you are on |
selection | "default" | highlighted but not where you are |
edited | "yellow" | a row you have changed, before :w |
added | "green" | a row you have added, before :w |
deleted | "red" | a row marked for deletion, before :w |
modal_border | "gray" | modal borders, and the ring around them |
modal_focus_border | "cyan" | the same when focused |
modal_title | "white" | modal titles |
modal_focus_title | "cyan" | the same when focused |
A table's column separators and the rule under its header are drawn in the
pane's border color, so a whole frame is one color: focus_border when you are
in it, border when you are not.
[icons]The glyph beside a connection name, by driver. The defaults are Nerd Font devicons, written as escapes here because they are private-use codepoints that only a Nerd Font draws. Your config file can hold either the escape or the glyph itself.
[icons]
mysql = "\uE704" # nf-dev-mysql
pgsql = "\uE76E" # nf-dev-postgresql
sqlite = "\uE7C4" # nf-dev-sqllite
sqlsrv = "\uF1C0" # nf-fa-database
default = "\uF1C0" # anything else
No Nerd Font? Any character works: mysql = "M", or "" for nothing at all.
[updates]| Key | Default | Meaning |
|---|---|---|
check | true | look for a new release once a day |
automatic | true | install it by itself, for the next time you start tql |
Once a day, when you start tql, it asks GitHub for the latest release in the background. Nothing about you or your databases is sent, and a failed check says nothing. What happens next depends on how you installed it:
automatic on, tql
downloads the new binary, checks it against the release's SHA256SUMS, makes
sure it runs, and keeps it in a .tql-versions folder beside tql. The
connection list says tql 0.8.0 is ready · restart to use it, and the next
start switches tql to it. It is a symlink into that folder, so a tql that is
already running, an MCP server included, keeps its own file and carries on.
The last three versions are kept. A download that does not match its checksum
is never installed..deb, .rpm, Arch package or PKGBUILD: tql never replaces a file a
package manager owns. The connection list says what to run instead, such as
tql 0.8.0 is out · brew upgrade tql.tql update does the same on the spot. check = false stops tql from asking
at all; so does TQL_UPDATE_CHECK=false in the environment.
[ai]What answers when you press a. Only table and column names are sent, never
rows. See Asking for SQL.
| Key | Default | Meaning |
|---|---|---|
provider | "auto" | auto uses url if it is set, otherwise the first provider you have an API key for |
model | "" | empty picks a sensible default for the provider |
timeout | 60 | seconds to wait for an answer |
url | "" | an OpenAI-compatible endpoint instead, such as LM Studio |
key | "" | bearer token for that endpoint, if it wants one |
[mcp]What an agent sees through tql mcp:start. It can always query the
connections; this is about your screen. See For agents.
| Key | Default | Meaning |
|---|---|---|
read_screen | false | let an agent read what you see in the tql you have open |
read_production | false | let it read a connection tagged production too |
Tags are deliberately not configurable: production is red in your terminal and
in the next person's screenshot. See Tags and read only.
SSL mode on a server connection takes disable, prefer, require,
verify-ca or verify-full, and reveals the CA, cert and key fields. Managed
databases usually want require and a CA certificate. Only verify-full
checks the hostname.
tql tableplus --dry-run # what would come over
tql tableplus # bring it over
tql reads the connections TablePlus for Mac has saved and adds each one, with its group, its environment as a tag, and its SSH tunnel and TLS settings. Passwords come from the Keychain: macOS asks you to allow each one, and Deny leaves that one out. Connections tql already has are left alone, so running it again is safe; ones tql cannot open, such as Redis, are listed and skipped.
| Flag | What it does |
|---|---|
--dry-run | list what would come over and what would be skipped, and change nothing; the Keychain is not touched |
--without-passwords | bring the connections over but leave every password in the Keychain; add them later with e |
--from=<folder> | read TablePlus's Data folder from somewhere other than ~/Library/Application Support/com.tinyapp.TablePlus (or its Setapp twin) |
--json | answer in JSON, which is what you get anyway when the output is piped |
--table | answer in lines for a person, which is what you get anyway in a terminal |
A connection TablePlus is set to ask about every time keeps no password, and
neither does an SSH key's passphrase: tql leaves the key to ssh, your agent
and ~/.ssh/config. TablePlus for Windows and Linux is not supported yet.
Or ask your agent to move me from TablePlus to tql: both runs answer in JSON
when an agent makes them, nothing in that JSON is a password, and
tql tableplus --help tells the agent to show you the dry run first.
tql export writes rows as SQL you can read. For a whole database, schema and
all, and fast enough for tables in the tens of gigabytes, there are three
commands: tql dump writes a database to a folder, tql load reads one back,
and tql sync does both in one step. They hand the work to the tools built for
it, and give them your saved connection, password, TLS and SSH tunnel included:
| Database | Dumps with | Loads with | Install |
|---|---|---|---|
| MySQL | mydumper | myloader | brew install mydumper |
| Postgres | pg_dump | pg_restore | brew install libpq |
| SQLite | tql itself | tql itself | nothing |
All three work in parallel, from a consistent snapshot, and split big tables
into pieces. While they run you see a progress bar counting tables, with the
one being worked on under it; -v shows everything the tools say instead.
--dry-run shows the exact command without running it, and the password is
never on it: tql hands it to the tool in a private file that is gone when the
command ends.
tql dumptql dump notarydash-prod # every table, into a new folder
tql dump notarydash-prod orders users --to=./nd # two tables, into a folder you name
tql dump mysql-dev --database=shop # a server connection that names no database
The dump goes in a new folder beside your exports unless --to
says where, and tql checks the drive has room first. Postgres dumps are
compressed; MySQL dumps are not, because myloader 1.0.5 hangs loading
compressed files on macOS, so allow about the size of the data. A tql.json
in the folder records where the dump came from, which tql load reads.
| Argument or flag | What it does |
|---|---|
<connection> | the saved connection to dump |
[tables…] | only these tables; every table when none are named |
--to=<folder> | where to write the dump; it must be new or empty |
--database=<name> | which database on the server, for a connection that names none |
--threads=<n> | how many tables, or pieces of a table, to dump at once; 4 unless you say |
--data-only | rows only, for loading into tables that already exist |
--no-lock | skip the consistent snapshot, for a MySQL user without the privileges it needs; tables are then read at slightly different moments |
--force | dump even when the drive looks too small |
--dry-run | show the command tql would run, and stop |
-v | show everything the tool says instead of the progress bar |
tql loadtql import is the same command.
tql load ./nd notarydash-local # a dump into tables that do not exist yet
tql load ./nd notarydash-local --drop # replacing tables it already has
tql load ./nd mysql-dev --database=nd_copy # into a database it creates
tql load ./orders.sql notarydash-local # replay a tql export, all or nothing
A dump folder is loaded with myloader or pg_restore, and a load stops at a
table that already exists unless --drop says to replace it. A .sql file
from tql export is replayed in one transaction: if a statement fails,
nothing is loaded. A dump only loads into the same kind of database it came
from.
| Argument or flag | What it does |
|---|---|
<source> | a folder from tql dump (or straight from mydumper or pg_dump), or a .sql file from tql export |
<connection> | the saved connection to load it into |
--database=<name> | which database on the server, for a connection that names none; MySQL creates it if it is not there |
--drop | drop and recreate tables that already exist; for a SQLite connection, replace the file |
--threads=<n> | how many tables, or pieces of a table, to load at once; 4 unless you say |
--force | load into a connection tagged production without being asked |
--dry-run | show the command tql would run, and stop |
-v | show everything the tool says instead of the progress bar |
tql synctql sync notarydash-prod local --database=notarydash # same name on both sides
tql sync notarydash-prod local --database=notarydash --into=nd_copy # another name locally
tql sync notarydash-prod local --database=notarydash users orders # just these tables
tql sync notarydash-prod staging --database=notarydash # remote to remote
A sync dumps from the first connection and loads into the second, replacing
the tables it brings over and leaving the rest alone. The first connection is
only ever read. Either side can be local or remote; between two servers, the
data passes through your machine. The dump goes through a folder that is
deleted afterwards, unless --keep keeps it as a backup.
The database on each side: the source uses --database, or the one its
connection names. The target uses --into, or the one its connection names,
or else the same name as the source.
| Argument or flag | What it does |
|---|---|
<from> | the saved connection to copy from |
<to> | the saved connection to copy into |
[tables…] | only these tables; every table when none are named |
--database=<name> | the database to copy, for a connection that names none |
--into=<name> | what the database is called on the other side, when it is not the same |
--threads=<n> | how many tables, or pieces of a table, to copy at once; 4 unless you say |
--no-lock | skip the consistent snapshot, as for tql dump |
--via=<folder> | the folder the copy passes through; beside your exports unless you say |
--keep | keep that folder afterwards, as a backup |
--force | copy into a connection tagged production, or past the free space check |
--dry-run | show both commands without running them |
-v | show everything the tools say instead of the progress bars |
tql load and tql sync refuse a read-only connection, and ask before
writing to one tagged production: in a script, where there is no one to ask,
they need --force. A sync will not copy a database onto itself. None of them
move data between engines, and SQL Server is not supported yet.
A connection can carry a tag, and the tag decides its color:
| tag | color |
|---|---|
| production | red |
| staging | yellow |
| dev | blue |
| local | green |
The tag colors the driver icon and the tag itself in the connection list, and
the connection name in the status line while you are in it, so the screen
tells you where you are before you press d.
It is a fixed set rather than a configurable one, on purpose: the point of a tag is that production looks the same in your terminal and in someone else's screenshot.
Read only refuses every write on that connection: no edits, no marks, no
:w, and the SQL editor runs only statements that read.
A connection can also carry a group, set in its form. The connection list
shows each group under a header, after the connections without one, with the
number of connections in it, and space folds it shut. Folded groups stay
folded the next time.
Press e on a group's header to rename it, for every connection in it. A name
another group already has merges the two.
MySQL, Postgres and SQL Server connections are a server, not a single database.
Press b to list the databases on that server and switch to one; the tables
pane titles itself with the database you are in.
Leave the Database field empty on a server connection and tql asks on connect, opening the list as soon as it is in.
Type a name the list does not have and its last row offers to create it. On a
connection tagged production, ↵ puts create database <name> on the
command line for a second ↵ instead of creating it straight away;
confirm_create_on_production = false in [ui] turns that off.
The switch lasts for the session only. It is never written back to the saved connection, so the connection still opens on its own database next time. It also drops the current filter, sort and any pending edits, since none of them mean anything in another database.
A SQLite connection is one file, so b says as much and does nothing.
On Postgres and SQL Server, the table list shows every schema, not only your
default one. Each schema is a header you fold with ↵, h and l; yours comes
first and open, the rest folded, and tql remembers what you fold. A table
outside your default schema is called schema.table everywhere: in the grid,
the palette, tql tables, tql describe, tql export and the MCP tools, and
completion offers it that way. / searches every schema at once.
A connection can reach its database through an SSH tunnel. Set SSH host on a mysql, postgres or sqlsrv connection and the rest of the fields appear:
| field | what it is |
|---|---|
| SSH host | the machine you can reach, e.g. bastion.example.com |
| SSH port | 22 unless you say otherwise |
| SSH user | the user on that machine |
| SSH key | a key file; empty uses your agent and ~/.ssh/config |
| SSH password | for a bastion that wants one instead of a key |
Press ↵ on SSH key and it lists the private keys it found in ~/.ssh,
so there is no path to remember. The same goes for the SSL certificate fields,
which also look in ~/.postgresql, ~/.mysql, ~/certs, ~/Downloads and
the current directory. type a path… is always the last option.
tql opens ssh -N -L <free port>:<db host>:<db port> and points the driver at
that local port, so the database only ever sees a connection from the machine
you tunnelled through.
It shells out to your own ssh rather than speaking the protocol, which means
your agent, your keys and your ~/.ssh/config all apply, including Host
aliases and jump hosts. A connection you can already make by typing ssh prod
works by putting prod in the SSH host field.
The tunnel is opened once per destination and reused, and stays open until tql exits. tql waits for the forwarded port to accept a connection before running anything, so the first query cannot race the tunnel coming up, and if ssh fails it says what ssh said. While it connects, the connection list stays on screen and says so.
The sample database used in development is Chinook, which is not committed. A database file changes every time you edit a row, and a repository that reports itself modified after every demo is no use.
curl -L -o chinook.db https://github.com/lerocha/chinook-database/raw/master/ChinookDatabase/DataSources/Chinook_Sqlite.sqlite
tql chinook.db
Running tql with nothing after it opens the connection list. To skip it and
open a SQLite file straight away, point tql at the file:
tql test.sqlite # same as: tql open test.sqlite
tql ~/Sites/app/db.sqlite
tql test.sqlite --name=scratch # and call it "scratch" in the list
A connection string works the same way:
tql 'mysql://user:pw@db.example.com:3306/shop'
tql 'postgres://user:pw@host/shop?name=Staging'
mysql, mariadb, pgsql, postgres, postgresql, sqlsrv, mssql and
sqlite schemes are understood. The default port is filled in per driver,
credentials are percent-decoded, and ?name= sets the label shown in the
title bar.
Anything you open is remembered, so you only ever paste a connection string
once. --name= names it in the list; without one it is named after the file, or
database on host. --peek opens without remembering, for a database you are
only glancing at. Re-opening somewhere you already have saved reuses that
connection rather than making a second, and --name= on it is a rename. Names
are unique, so a second database.sqlite becomes database.sqlite (2).
A connection string on the command line goes into your shell history. Paste
it once, then use the connection list, where the password is encrypted at rest.
Prefixing the command with a space keeps it out of history in zsh if
HIST_IGNORE_SPACE is set.
A first argument that exists on disk, contains a /, ends in .sqlite,
.sqlite3 or .db, or looks like a connection string is treated as a path
rather than a command name. A file that exists is never a command name, which
makes the rewrite unambiguous. On first run tql creates ~/.config/tql/
containing tql.sqlite (connections and query history) and key (the
encryption key), both 0600.
| Key | Action |
|---|---|
tab | switch between the table list and the grid |
alt+1 alt+2 alt+3 | go to the table list, the rows or the SQL editor |
\ | hide or show the table list |
↑ ↓ / j k | move the cursor; 5j moves five rows, 3l three columns |
← → / h l | move between columns; → from the table list moves to the grid |
↵ | open a table, or edit the selected cell |
i | view the selected value in a modal, read-only |
e | edit the selected value, ctrl+s saves |
E | edit the whole row in a form |
ctrl+k | the command palette: every action, table, database and connection |
< > | narrow or widen the selected column, or the table list when you are in it |
= | reset the column width |
n / p | next or previous page (100 rows) |
r | reload the current table |
o | sort by the column the cursor is on |
N | add a row, in a form |
y / Y | yank this value, or the whole row as an object |
d / u | mark the row for deletion, or clear every mark |
L | follow a link, esc comes back |
a | ask in English for SQL; see Asking for SQL |
b | switch database on this server |
s | open the SQL editor |
: | command line: :q, :tables, :rows, :reload, :sql |
q / esc | quit |
docs/keys.md has the rest: the filter form, the inspector, the
SQL editor, the lists, the connection form, the command line. It also covers how to
rebind any of it with [keys] in the config, which help and the hotkey bar
follow.
Mouse works too: click a table or a row, scroll with the wheel, and drag a column border in the header row to resize it, as you would in a spreadsheet.
Column widths you set are remembered per column name, so several columns keep their sizes at once and survive paging and switching tables.
t shows the table's structure: every column with its type, which one is the
primary key, which are foreign keys and where they point, what is not null,
what auto-increments, and the defaults, then the indexes.
STRUCTURE · albums
AlbumId integer primary key · not null · auto
Title text not null
ArtistId integer → artists.ArtistId · not null
indexes
IFK_AlbumArtistId (ArtistId)
j/k scroll it, t, q or esc close it.
While the cursor is on a foreign key, the status line says where it goes:
L → artists.
With the cursor on a foreign key, L opens the table it points at, filtered to
the row it points to. From anywhere else on the row, L goes the other way:
the tables that reference this one. If more than one does, it offers a list.
esc goes back where you came from, and so does ctrl+o if vim's jumplist is
in your fingers. The stack is as deep as you followed, so a chain of links
unwinds one step at a time.
The jump is an ordinary filter, so the SQL pane shows the where clause that
made it. Following a link teaches you the query you would have written.
f opens a filter bar, TablePlus style: a column, an operator and a value.
┌─ FILTER ───────────────────────────────────────────────────────────┐
│ │
│ where city is Toronto │
│ and age is at least 18 │
│ │
│ ← → changes it ↑↓ moves + adds - removes ctrl+s applies│
└────────────────────────────────────────────────────────────────────┘
f opens on the column you are on, with contains, already typing. The
column and operator are guesses, the value never is. ↵ keeps the value and
↵ again applies it; esc steps back into the form to move around.
tab and shift+tab move between the three cells. On the column or operator,
↵ opens a type-to-filter list (start typing to narrow it, arrows to move, ↵ to pick)
and ← → step through the options without opening it. On the value, ↵ types.
+ and - add and remove conditions, o switches the whole bar between and
and or, ctrl+s applies and esc clears.
The list is drawn inside the frame, so picking from it never leaves the interface.
Operators: is, is not, contains, starts with, ends with, is greater than, is at least, is less than, is at most, is empty, is not empty, is one of (a comma-separated list).
The filter becomes a where clause on the query, so the SQL pane shows exactly
what ran, which is the point. Values are bound, never interpolated, so a
value containing a quote is a value rather than SQL. The pane shows the
statement with the values filled in for reading; that form is never sent to the
database.
Filters are dropped when you change table, since a column that exists in one table usually does not in another.
Click a column header, or press o on a column, to sort by it: first click
ascending, second descending, third clears it. The header shows ▲ or ▼, and
the order by appears in the SQL pane, so the sort teaches the clause that
produced it.
Sorting applies to a table, not to query results; those are ordered by whatever your query says.
With ui.sql_always on, the SQL pane shows the statement that produced what you
are looking at, and updates as you change table or page:
┌─ SQL ────────────────────────────────────────────┐
│ select * from "tracks" limit 100 offset 100 │
└──────────────────────────────────────────────────┘
Press s and that statement is handed to you to edit. Change the limit, add
a where, press ctrl+r, and the grid shows your version.
The pane always mirrors what you are looking at: change table, sort, or page and it rewrites itself to the query that produced the rows on screen, discarding an edit you never ran. While you are typing in it, nothing overwrites you.
Press a and ask in plain english. The answer lands in the editor, with the
explanation as -- comments above it, and nothing runs until you press
ctrl+r.
-- Counts how many invoices each customer has. The join matches each invoice to
-- its customer on customer_id, group by makes count() run per customer, and
-- order by puts the busiest first.
--
select c.name, count(i.id) as invoices
from customers c
join invoices i on i.customer_id = c.id
group by c.id, c.name
order by invoices desc
limit 50
The model writes queries; it never runs them. It is asked for exactly one statement, reads only, and is told to use nothing outside the schema, and it still lands in front of you for review rather than in front of your database.
Only table and column names are sent. No row data ever leaves the machine, so asking about a production table does not send its contents anywhere. The table you are looking at is sent first so it survives the size limit.
Press a and a modal opens with a text area. ↵ asks, ⇧↵ starts a new line,
esc cancels. ctrl+s sends it too. tql keeps drawing while the model thinks,
and esc while it is asking throws the answer away when it comes.
Terminals send the same byte for enter and shift+enter, so shift+enter only arrives as its own key when the terminal is told to send one. In Ghostty:
keybind = shift+enter=csi:13;2u
Alt+enter works without any configuration, if you would rather not set that.
Whatever you have a key for. With provider = "auto", tql uses url if you
set one, and otherwise the first provider it finds a key for in your
environment, so setting ANTHROPIC_API_KEY or OPENAI_API_KEY is all it
takes:
[ai]
provider = "auto" # or anthropic, openai, azure, gemini, groq, mistral, deepseek, xai, openrouter, ollama
model = "" # empty uses a sensible default for that provider
timeout = 60
| Provider | Key | Default model |
|---|---|---|
anthropic | ANTHROPIC_API_KEY | claude-sonnet-5 |
openai | OPENAI_API_KEY | gpt-5 |
azure | AZURE_OPENAI_API_KEY, with AZURE_OPENAI_URL | gpt-4o |
gemini | GEMINI_API_KEY | gemini-2.5-pro |
groq | GROQ_API_KEY | llama-3.3-70b-versatile |
mistral | MISTRAL_API_KEY | mistral-large-latest |
deepseek | DEEPSEEK_API_KEY | deepseek-chat |
xai | XAI_API_KEY | grok-4 |
openrouter | OPENROUTER_API_KEY | anthropic/claude-sonnet-5 |
ollama | none, once OLLAMA_URL is set | llama3.2 |
auto tries them in alphabetical order and takes the first that is set up, so
with several keys in your environment, name the one you want in provider. A
named provider with no key falls back to url. Each provider's address can be
moved with its own variable, such as ANTHROPIC_URL or OPENAI_URL, for a
proxy or a gateway. TQL_AI_PROVIDER, TQL_AI_MODEL, TQL_AI_TIMEOUT,
TQL_AI_URL and TQL_AI_KEY in the environment win over config.toml.
Anything with an OpenAI-compatible API works. LM Studio, start to finish:
Install a model in LM Studio. A coding model is the right shape for this, and
qwen2.5-coder-7b-instruct is a good starting point.
Open the Developer tab and Start Server. It listens on port 1234 by
default and speaks OpenAI's API at http://localhost:1234/v1.
Ask it what it is serving, and use that name verbatim:
curl -s http://localhost:1234/v1/models | jq -r '.data[].id'
# qwen2.5-coder-7b-instruct
Put both in ~/.config/tql/config.toml:
[ai]
url = "http://localhost:1234/v1"
model = "qwen2.5-coder-7b-instruct"
key = "" # LM Studio does not want one; some gateways do
Press a in tql and ask for something.
With provider = "auto", a url wins over any key in your environment, since
it points somewhere deliberate. Nothing leaves your machine in that setup, and
only table and column names were ever being sent anyway.
Ollama is the same shape, on its own port:
[ai]
url = "http://localhost:11434/v1"
model = "qwen2.5-coder"
LM Studio may want a token. It says so in the Developer tab, and it goes in
key. A url with no path gets /v1 added, so http://localhost:1234 and
http://localhost:1234/v1 both work.
A reasoning model such as qwen3 answers in its thinking rather than in the message body, and tql reads the answer out of it either way.
If a says there is no model to ask, tql could not find a url or a key, and it
says what to set. If it fails at the network, the server is not running or the
port is wrong, and the curl above is the quickest way to tell which.
Everywhere you type something that then has to happen (a value, a filter, a
question), ↵ does it and ⇧↵ adds a line. ctrl+s still works if it is in
your fingers.
The SQL editor is the exception. ↵ adds a line there and only ctrl+r runs
the statement under the cursor, so a long query never goes off half written,
and a buffer of several statements runs one at a time. Set
sql_editor = "vim" in [ui] for a vim editor instead (motions, operators,
text objects, visual mode, undo and .), where :r runs the statement; see
the SQL editor.
Shift+enter needs a terminal that sends something distinct for it. In Ghostty:
keybind = shift+enter=csi:13;2u
Alt+enter works without any configuration.
The SQL pane is syntax highlighted: keywords, quoted identifiers, strings, numbers and comments each colored, the same tokeniser approach as the JSON viewer and equally careful never to drop a character while you type.
Press s (or :sql) for the SQL editor, which opens above the results.
ctrl+r runs what you have typed, esc returns to browsing. As you type, it
offers the tables, columns and keywords that fit, and tab takes one. Results replace
the grid and are read-only, since they have no primary key to write back
through. Open a table to edit.
H from the grid, or alt+h from the editor, opens the history: every
statement you have run from the editor on this connection, and every one your
agent ran with tql query or over MCP, newest first and once each. Type to narrow it; ↵ puts the
statement back in the editor, ready to change or run. What tql runs by itself
(paging the grid, the updates behind :w) is not in it.
A cell holding JSON opens in a full-width modal when you press i: pretty
printed, with line numbers and syntax highlighting, with keys, strings, numbers and
literals each colored. ↑↓ scrolls a line at a time, n/p a page, esc
closes.
Detection is by parsing, not by column type, so JSON stored in a text column
is recognised too.
i floats two boxes over the grid: the record itself, and the records related
to it. Folding a box collapses it to its title bar, so the shape of the modal
tells you what is open, and the table stays visible behind.
┌─ RECORD (3) ───────────────────────────────────────────────┐
│ AlbumId 1 integer │
│ Title For Those About To Rock We Salute text │
│ ArtistId 1 integer │
└─────────────────────────────────────────────────────────────┘
┌─ RELATED (2) ──────────────────────────────────────────────┐
│ ▾ artists (1) │
│ ArtistId Name │
│ 1 AC/DC │
│ ▸ tracks (10 of 47) │
└─────────────────────────────────────────────────────────────┘
Column, value, then the type as an annotation. Related records stay as collections: one header for the relation, then a line per record.
↵ or space folds whichever box or relation the cursor is on. j/k move,
g/G jump, V selects, y yanks, esc closes. e on a field opens the
editor on that column, not whichever one the grid cursor was on.
Each relation says what it is: belongs to when this row holds the key, has many for the rows pointing back, and has one when a unique key on the other side means there can only be one. A single record reads as fields; a list reads as a table.
A join table is read through, not shown: a film's film_actor rows are a
list of timestamps, so tql shows actors · has many through film_actor with
the actors in it. A join table that carries data of its own (a quantity, a
price) is a table in its own right and is shown as one.
Every column of a related row is shown, laid out to the width you actually have:
the columns that already fit are left alone and what is left over is shared
between the ones that do not, with an … where a value was cut. Nothing is
dropped, so the row you are reading is the row that is there, and i on the row
in its own table opens the whole of it. Widen the terminal and the columns widen
with it.
Relations are found by following foreign keys both ways.
ui.inspect_related caps how many rows are loaded (10 by default, 0 turns it
off); when there are more, the heading says (10 of 47).
I opens just the value under the cursor, for a single enormous blob.
From the command line, which is the scriptable way:
tql export # asks which connection, then which table
tql export prod orders --limit=1000 --sql=./orders.sql
tql export prod --sql=./prod.sql # every table, one file
tql export prod --list # what tables are there
tql export prod --database=shop # pick the database on a server connection
A connection that names a server rather than a database asks which one first,
or takes --database=; without either it stops and says so rather than
exporting every schema on the box.
Name a connection and it goes straight through; name nothing and it asks three
questions: which connection (most recently used first), which table (the whole
database is the first answer), and where to save it, offering the auto-named
file in the export directory. Answer that last one with a folder and it names
the file for you; --sql skips the question. Piped or with --no-interaction it
never asks. It says what it needed and stops with a non-zero exit.
Save one somewhere else, ~/Downloads say, and that becomes the folder the
next export is offered in. ui.export_path in the config overrides it, and if
the remembered folder is gone tql falls back to its own.
--sql takes a file or a directory; omit it and the file is named
automatically in the export directory, after the database, the table and the
time (karlm_v2-users-20260922-231302.sql, or karlm_v2-20260922-231302.sql
for the whole thing), since the connection's own name says nothing about what is
in the file. --limit caps rows per table, which is
how you pull a slice of production rather than all of it.
Inside the interface, :export writes what you are looking at to a .sql file of insert
statements. On a table that is every row, read in chunks so a large table does
not go through memory at once; after a query it is the rows you have loaded.
Files land in ~/.config/tql/exports (override with ui.export_path), named
connection-table-YYYYMMDD-HHMMSS.sql. The status line reports the row count,
file size and path.
Data only, no schema. Your migrations own the schema; this is for pulling rows from one database into another.
Select a cell and press e or ↵. ↵ saves, esc cancels. An empty value
writes NULL. E edits the whole row in a form, see
Editing a row in a form.
Editing requires a single-column primary key, which tql uses to target the
row. Tables without one are read-only, as are connections flagged read_only.
The first screen lists your saved connections.
| key | what it does |
|---|---|
↵ | open it |
e | edit it in place |
n | add one |
d | mark it for deletion |
u | clear every mark |
:w | write the marked deletions |
Adding and editing happen in a modal over the list, never by dropping out to a
prompt sequence. ↑↓ picks a field, ↵ edits it with a real cursor (arrows,
home, end, backspace, delete, paste), ctrl+s saves and esc cancels. Nothing
is written until you save. The driver is cycled with ← →, through all
eight.
N opens a form over the grid, one field a line:
┌─ NEW ROW · film ───────────────────────────────────────────────┐
│ │
│ film_id (integer): auto │
│ │
│ title (varchar): required │
│ │
│ rating (varchar): G │
│ │
│ last_update (timestamp): now() │
│ │
│ token (text): default gen_random_uuid() │
│ │
│ │
│ ↑↓ move ↵ edit ctrl+n null ⌫ reset ctrl+s keep esc cancel │
└──────────────────────────────────────────────────────────────────┘
↵ types into a field and ↵ or tab keeps it and moves on; json, and a value
too long for its line, open in the value editor instead. ctrl+s keeps the row
and puts it on top of the grid, where you are already looking, drawn in the
added colour. Nothing has happened until :w.
The form fills in what it can, so you can see it before you keep it:
rating starts as G. Change it
or leave it.current_timestamp, now(), datetime('now')) starts
as now(), which becomes the time when you keep the row, the way the column
writes it.A field that is not null and has nothing to fall back on says required, and
the cursor starts on the first field that is yours to fill in. ctrl+n sets a
field to NULL (an explicit one, written as NULL rather than left to the
default) and ⌫ puts a field back to how it started.
The row is a row like any other once it is kept: e changes one cell of it,
E opens it in the form again, and u drops it. The cursor is visible inside
it. A marked, edited or added row is drawn as one bar, and the cell you are on
is a span of its own inside it.
e edits one value. E opens the whole row in the same form, on the field for
the column you were on, with the row's values in it. ctrl+s keeps only the
fields you changed, as pending edits, and the row goes yellow in the grid.
The primary key is shown but not editable, because it is how tql names the row.
esc closes the form. If you changed something it asks first: esc again
throws the changes away, any other key keeps you in the form.
Any date, time or timestamp column takes ctrl+t while editing: it types
the current time into the editor, in the format that column wants (Y-m-d for
a date, H:i:s for a time, Y-m-d H:i:s for a datetime or timestamp), so you
can see it before keeping it. The status line says so while you are in one.
Typing now() does the same thing without the shortcut, wherever it is
typed, since an explicit now() is an instruction rather than a value. That is
how created_at and updated_at get filled in without looking up a format.
It writes UTC, because that is what a database column almost always holds
and a row written in local time is wrong in a way nobody notices for months.
The status line names the zone (ctrl+t now UTC) and [ui] time_zone in the
config changes it:
[ui]
time_zone = "America/Toronto"
u drops it, a reload keeps it, and changing table forgets it. It works on a
table with no primary key, which editing does not: a row that is not in the
table yet is written by position rather than by key.
A database refusing a write is the most important thing on the screen, so it takes the screen: the error opens as a modal over whatever you were doing, with the statement it refused on its own line and what to do next under it.
┌─ COULD NOT ADD THE ROW ──────────────────────────────────────┐
│ │
│ UNIQUE constraint failed: people.email │
│ │
│ insert into "people" ("name", "email") values (…) │
│ │
│ The row is still here. Fix it and :w again, or u to drop it.│
│ │
│ y copies it esc closes │
└──────────────────────────────────────────────────────────────┘
The error is in the database's own words, with nothing of tql's wrapped around
it. j/k scroll a long
one, y copies it, any other key closes it. Your pending changes are still
pending: nothing is dropped because a write failed.
Nothing you do to a row reaches the database until you ask for it.
| key | what it does |
|---|---|
e | edit the value; ctrl+s keeps the edit, pending |
E | edit the whole row in a form; ctrl+s keeps it, pending |
| double click | the same, with the mouse |
d | mark the row for deletion, and move down |
u | drop every pending change |
:w | write them all |
Edited rows are highlighted in theme.edited (yellow) and show the value you
typed rather than what is still on disk. Rows marked for deletion are
highlighted in theme.deleted (red). The status line counts both.
Changes are keyed by primary key, so sorting, filtering or reloading keeps them
on the rows you picked, and they are dropped when you change table, because a mark
means nothing in a table where that id is a different row. Quitting with
unwritten changes drops them and says so; :q again leaves.
d marks the row under the cursor and moves down, so a run of rows is ddd.
Nothing is written yet: marked rows are highlighted in theme.deleted (red by
default), d again unmarks, and u clears every mark.
:w writes them, all in one transaction. Until then the database is untouched.
Marks follow the row, not its position, so sorting or reloading keeps them on
the rows you picked. Quitting with unwritten marks drops them and tells you,
rather than either losing them silently or writing something you did not ask
for. Press :q again to leave.
A table with no single-column primary key cannot be deleted from, because there is no safe way to name the row; it says so rather than guessing.
An agent can reach your databases two ways, and both use the same engine, the same connections and the same rules as you.
Plain commands, which any agent that can run a shell already knows how to use:
tql connections # what is saved
tql tables prod # its tables; --database= for another one on the server
tql describe prod orders # columns, types, primary key
tql query prod "select count(*) from orders where placed_at > now() - interval 1 day"
echo "select 1" | tql query prod - # or pipe the statement in
They never prompt or draw a screen. In a terminal they print a table; piped or
captured, which is how an agent runs them, they print JSON. --table and
--json choose either way. A refusal or a database error goes to stderr with a
non-zero exit code. A query returns at most 200 rows unless you pass --limit,
and says when it stopped short.
A line in a project's CLAUDE.md (or AGENTS.md) is enough for an agent to
find them:
Query the database read-only with `tql query <connection> "<sql>"`; `tql tables` and `tql describe` show the schema.
An MCP server, for agents that prefer one:
claude mcp add --scope user tql -- tql mcp:start tql
Its tools (list connections, list tables, describe a table, run a query) give the same answers as the commands.
Either way it is read-only: only select, show, explain, describe,
pragma and with are accepted, one statement at a time, and the database
itself holds tql to it: SQLite runs the statement with query_only, MySQL and
Postgres in a read-only transaction. SQL Server has no read-only transaction,
so tql refuses a statement with a writing word anywhere outside its strings and
comments, such as update or into, and runs the rest in a transaction that is
always rolled back. A write hidden inside a with is refused. Writes happen in the
interface, not through an agent. Everything an agent runs lands in the same
history as your own statements, marked cli or mcp.
The MCP server has one more tool, write-sql-tool, for the statements an
agent should not run itself. It puts SQL in the SQL editor of the tql you have
open on the connection it names, in place of what was there, and tql switches
to the editor and says the SQL came from your agent. Nothing runs: you read it,
change it if you like, and run it yourself. One undo brings back what was in
the editor. With more than one tql open on that connection, the one you used
last gets it; with none open, the agent is told to ask you to open it.
read-screen-tool is the other direction: the agent sees what you see in
the tql you have open, so this row and these results mean something to it.
It gets the table or query results on screen, the statement behind them, what
is in the SQL editor, the sort, the row and column under your cursor, the page
of rows loaded, how many changes are unwritten and the status line. That is row
data, so it is off until you turn it on, and a production connection needs its
own say-so:
[mcp]
read_screen = true # let an agent read your screen
read_production = false # and a connection tagged production too
tql says your agent looked at your screen on its status line each time it does, and with sharing off it says your agent asked, while the agent is told what you would have to change.
cargo run # tql itself
cargo test # the suite
cargo build --release # target/release/tql
tql is written in Rust with ratatui for drawing. The interface is composed of islands: bordered boxes that own a rectangle, draw their own content and answer hit tests for it. Adding a pane means adding an island.
docs/developing.md has the rest: where everything lives, how a frame is drawn, the drawing rules that are easy to break, how to add a key, a modal, a command, an MCP tool or a setting, and how the interface is tested without a terminal.
docs/configuration.md is every setting, and
docs/keys.md is every key.
docs/packaging.md covers the binary, the .deb and the
.rpm, the Homebrew tap and the AUR package.
Connection passwords and SSH passwords are encrypted with AES-256-CBC using a
key at ~/.config/tql/key, 0600, in the same format tql has always written,
so a store from any earlier version opens. Filter values are always bound,
never interpolated. The SQL pane shows them filled in for reading, and that
string is never what runs.
Loading reviews...
GitHub checked 135h ago - refresh overdue. Recently viewed repositories target hourly refresh.
Find a documented setup for your client. No sign-in, installation, or tool execution.
If this MCP is also published on mcpchannel.ai, you can subscribe from Browse and use the gateway config there instead.