Guide · Doing
History and SQL files
Read this when you need a query you ran last Tuesday, or want to know what Seqora writes to disk about the SQL you type. History is automatic and short-lived. Files are the SQL you chose to keep.
Find a query you ran
- Click
Historyat the top of the sidebar, or runShow query historyfrom the command palette. - Choose
AllorThis connection. - Type part of the SQL or the connection's name into the search box.
- Click the run you want.
The SQL opens in an editor. Seqora never re-runs it for you. Press ⌘↩ or Ctrl+Enter when
you're ready.
Runs are grouped by day. Each shows its status, the time, the connection in All, how long it
took and the rows it affected. Failed and Rolled back narrow the list to those runs. Two
badges mark transactions: Rolled back, "This run's transaction was rolled back; its changes
did not persist.", and Uncommitted, for a run whose transaction was still open when it was
recorded.
What history keeps
Settings › Privacy says it under Query history: "The SQL you run is kept encrypted on this device for 30 days. Results are never stored."
- Each run's SQL, up to 16,384 characters, with its status, duration and affected-row count.
- At most 500 runs across every connection, and none older than 30 days.
- No result rows, column names, notices or error messages.
- Changes applied from the grid (Edit data), one run per statement.
- No passwords.
ALTER ROLE … PASSWORD,IDENTIFIED BY,SET PASSWORD, a password inside a connection string, a SQLCipherPRAGMA key, and the same things inside aDObody, anEXECUTEstring or aformat()call are replaced with<redacted>before the run is written. The SQL that runs is untouched.
History lives in Seqora's encrypted app database on this computer. Deleting a connection deletes its history too. Anything you want to keep longer than 30 days belongs in a file.
Opening a redacted run says so: "History kept this query with its passwords taken out. Replace
each <redacted> is only text, so the
statement could run with it. Read it before you press ⌘↩.
Clear a connection's history
- Switch the view to
This connection. - Click
Clear this connection’s history…. - Click
Clear history.Keepbacks out.
Save a query as a file
- Press
⌘SorCtrl+Sin an editor. - Type a
File namein theSave SQLdialog, for examplerefunds-last-30-days. - Press
Enter.
Seqora writes refunds-last-30-days.sql into its SQL library, a folder named sql in Seqora's
app data folder. The sidebar's Queries view lists that folder: click Queries, or run
Show saved queries from the palette. From then on ⌘S writes back to the same file without
asking. If the name is already taken, the first save asks Replace refunds-last-30-days.sql?
and says that replacing can't be undone. Replace overwrites, Esc keeps both.
To put the file somewhere else, such as a migrations folder in your repository, use
Save SQL as…, ⇧⌘S or Ctrl+Shift+S. It asks for a folder.
Open a file from disk
- Press
⌘OorCtrl+O, or runOpen file…from the palette. - Pick a
.sqlfile.
The file opens in an editor that saves back to the same path. Double-clicking a .sql file in
the OS or dropping one on the window does the same, up to 20 files at a time. A file that is
already open is focused, not opened twice.
The editor keeps the file as it found it. A UTF-8 byte order mark is dropped on the way in and written back on save, and a UTF-16 file stays UTF-16. A file over 2 MB is refused with "…is larger than 2 MB, the most a SQL editor opens.", and a file that isn't UTF-8 or UTF-16 text with "Save it as UTF-8 and open it again."
A file remembers no connection, so it opens on the active one. If that connection is production, Seqora asks first: "commerce-primary is a production connection, so Seqora asks before opening refunds-last-30-days.sql on it."
Drafts and restored tabs
An editor you never saved isn't lost. Seqora saves its text as a draft about a second after you
stop typing, in the encrypted app database. With Restore open tabs and panel layout on, in
Settings › General, your editors come back when Seqora starts.
Recent scripts lists your SQL editors, saved or not, with the folder of each saved one. Open
it from the palette with Open recent SQL script…, or with Browse recent scripts on an empty
workspace.
Close an editor
Closing an editor with unsaved edits asks Save changes to refunds-last-30-days?.
| Button | Key | What happens |
|---|---|---|
Save… |
⌘S or Ctrl+S |
Saves to a file, then closes. |
Don't save |
⌘⌫ or Alt+N |
Closes without writing a file. |
Esc |
Keeps the editor open. |
An editor that is still running a query asks Query still running and offers
Cancel query and close. One with an open transaction asks Transaction still open and offers
Roll back and close. Both offer Keep editing, and both need ⌘↩ or Ctrl+Enter, so a
stray Enter does neither. Closing an editor pane inside a split asks the same questions.
Custom commands
Custom commands are YAML files in ~/.seqora/commands/, %USERPROFILE%\.seqora\commands on
Windows, that run SQL and shell steps from the command palette. Start one with
New custom command… in the palette.
Caveats
- History is per computer. It isn't synced, and it isn't an audit log: a run that fails to record is skipped with a warning, and the query still runs.
Clear this connection’s history…appears only inThis connection. There is no button that clears every connection at once.- A run recorded without its SQL shows
SQL not recordedand can't be opened. Querieslists the library folder and nothing else. A file saved elsewhere withSave SQL as…is reached throughRecent scriptsorOpen file….- A history entry over 16,384 characters keeps the first 16,384. Save long migrations as files.