CLI
Query history
dbcode history prints the queries in your query history, the same rows the History view shows when you open it as a table. It reads the history from your editor profile, so the editor does not need to be running.
dbcode history --since 2026-11-03dbcode history -c prod --since 2026-11-03 --until 2026-11-10 --format csv--sincekeeps queries run on or after a date or time;--untilkeeps queries run before one. A plain date such as2026-11-03means midnight at the start of that day in your time zone. A date and time such as2026-11-03T09:00works too.-ckeeps queries run on one connection, by name or id.--formatworks as fordbcode query: a table on a terminal, JSON when piped, orcsv,tsv,jsonlandmarkdown.--appand--profilepick the editor and profile whose history to read.
Rows are newest first. Each has date, sql, connection, driver, actor (User or AI), client, surface, database, schema, duration (milliseconds), rows, affected, error, id, device id and session id. date is in UTC, in ISO 8601 format, so any language can parse it.
With history sync turned on, the output includes the queries synced from your other devices.
Save a daily export
Section titled “Save a daily export”This saves yesterday’s queries to a file named after the day (on Linux, use date -d yesterday +%F for the first line):
day=$(date -v-1d +%F)dbcode history --since "$day" --until "$(date +%F)" > "history-$day.json"Run it each day with cron, or with Task Scheduler on Windows.
Dev Containers, Remote-SSH and WSL
Section titled “Dev Containers, Remote-SSH and WSL”In a VS Code window connected to a Dev Container, an SSH host or WSL, dbcode history prints the history of that window’s DBCode.