sqlr All documentation GitHub

Manual › Reference

Set up your workspace and shortcuts

Use Preferences to make queries easier to read, control result sizes and choose defaults for each connection. The settings search finds both labels and related words, such as zoom for UI scale.

Change a setting

  1. Open Settings…, or press ⌘, on macOS (Ctrl+, elsewhere). The window is titled Preferences.
  2. Select a section or type in Search settings.
  3. For settings that support it, choose the global, profile or connection level.
  4. Change the value. Changes take effect in the running interface while you edit.
  5. Choose Apply to save and stay in Preferences, or Save to save and close.

Cancel restores the settings from when you opened the window or last chose Apply. Connection exposure changes in Agents apply and save immediately, separately from these preference edits.

Appearance preferences with theme, interface scale and accent color

Choose the right section

SectionUse it for
GeneralStop scripts at the first error, retain completed operations, include SQL in diagnostics, show empty explorer folders, check for updates
AppearanceSystem, Light or Dark theme, interface scale and accent color
EditorFont size, completion, line numbers, wrapping and SQL formatting
Result gridFetch size, row cap, memory budgets and the text displayed for NULL
Data formatsDate and number display, booleans, binary values and JSON
KeymapShortcut presets, custom bindings and conflicts
ConnectionsSeparate editor sessions, connection timeout and safety flags
AgentsMCP server, token and connection access
TerminalShell, working directory, font size and scrollback
DriversDatabase session properties, sidecar idle timeout and Driver Manager

Set global and connection defaults

An ordinary setting uses the most specific value available: connection, then its profile, then global, then the built-in default. A value marked as inherited shows where it comes from. Reset clears an override so the inherited value applies again.

flowchart LR
    Default[Built-in default] --> Global[Global setting]
    Global --> Profile[Connection profile]
    Profile --> Connection[Connection override]

Appearance, editor preferences, memory budgets, diagnostics privacy and terminal settings apply globally. Page sizes, data formats, connection behavior and driver session properties can also vary by profile or connection.

Read-only, Confirm writes and Confirm destructive statements are safety flags. An enabled flag at any applicable level stays enabled: a connection cannot turn off protection required globally or by its profile. See profiles and transactions.

Control result sizes

Setting in Result gridDefaultMeaning
Rows per fetch200Rows requested in each page, from 1 to 1,000,000
Maximum rows when loading all results100,000Limit for Fetch all; 0 removes the row cap
Memory per result128 MiBMemory budget for one SQL result; 0 removes this limit
Memory for all results512 MiBCombined memory budget for SQL results; 0 removes this limit
NULL textNULLDisplay text for a database NULL value

The memory limits move older SQL result chunks to private temporary storage while loading continues. All loaded rows remain available. Closing results releases their storage after the last reader finishes. Removing the row cap leaves the memory budgets active; the operating system manages the cache of mapped file pages.

Format displayed values

In Data formats, set date and timestamp patterns, number grouping, decimal places, boolean style, binary encoding and JSON layout. Each setting includes a sample preview. Empty date patterns and decimal places of -1 retain the value's original representation.

These options change presentation. Turn on Use these formats for export when exported text should use the same representation; it is off by default.

Data format preferences with date, numeric and JSON display options

Learn and change shortcuts

The tables show the default sqlr preset on macOS. On Windows and Linux use Ctrl for ⌘ and Alt for ⌥. Menus and Keyboard Shortcuts show the actual bindings for your platform and chosen preset.

Query actionShortcut
Run statement or selection⌘Enter
Run script⇧⌘Enter
StopEsc
Explain⌥⌘E
Explain analyze, which executes the statement⌥⇧⌘E
Commit⌥⌘Enter
Rollback⌥⌘Z
Navigation actionShortcut
New editor tab⌘T
New editor tab on current connection⌘N
Close tab⌘W
Reopen closed tab⇧⌘T
Next / previous tabCtrl+Tab / Ctrl+Shift+Tab
Go to tab 1 to 8 / the last tab⌘1 to ⌘8 / ⌘9
Open object⌘P
Commands⇧⌘P
Operations⇧⌘O
TerminalCtrl+Backtick on all platforms
Rename explorer itemF2
Pending changes actionShortcut
Apply pending changes⌘S
Discard pending changesNo default; run it from ⇧⌘P or bind a chord
RefreshF5 or ⌘R

Apply pending changes does what the screen's own Apply or Save button does, with the same confirmations:

Active screen⌘S appliesF5 or ⌘R
Result of a queryThe result's pending edits; a cell you are typing in is committed firstRuns the result's query again; asks first when edits are pending
Object editorThe Data page's row edits, the Permissions page's grants, or the schema changes on the other pagesLoads the object again; asks first when edits are pending
Users and rolesThe role's changesReloads the roles; asks first when edits are pending
Sessions and locks, Server propertiesNothingLoads a new snapshot
Redis keyThe edited value or the element you are editingScans the keys again and reloads the value
MongoDB or Elasticsearch documentsThe document in the JSON editorRuns the last request again
DDL viewerNothingLoads the DDL again

These shortcuts wait while a dialog is open. Refresh repeats only queries that read: a result of a statement that writes, such as DELETE … RETURNING, is left as it is.

Reopen closed tab brings back the tabs you closed during this session, the most recent first, up to 20. A reopened tab gets back its connection, database and text, or its object, but nothing runs until you run it.

Editor actionShortcut
Save snippet⇧⌘S
Format SQL⌥⌘L
Toggle line comment⌘/
Find / replace⌘F / ⌥⌘F
Find next / previous⌘G / ⇧⌘G
CompleteCtrl+Space
Undo / redo⌘Z / ⇧⌘Z
Indent / outdentTab / Shift+Tab
Select the next occurrence / every occurrence⌘D / ⇧⌘L
Undo the last cursor operation⌘U
Add a cursor above / below⌥⌘↑ / ⌥⌘↓
Add cursors at the ends of the selected lines⇧⌥I
Move line up / down⌥↑ / ⌥↓
Copy line up / down⇧⌥↑ / ⇧⌥↓
Delete line⇧⌘K
Select line⌘L
Outdent / indent line⌘[ / ⌘]
Result grid actionShortcut
Add row⌘I
Duplicate rows⌘D
Set NULL⌥⌘N
Delete selected rows⌘Backspace

The editor shortcuts follow VS Code. In a result grid, ⌘D duplicates rows instead of selecting text.

To customize a shortcut:

  1. Open Keymap in Preferences.
  2. Choose the sqlr or VS Code preset.
  3. Search for the command and use its recording control.
  4. Press the replacement chord, or Escape to cancel recording.
  5. Resolve any conflict marked in red before saving.

Commands can also be unbound or reset individually; Reset all restores the preset. A binding may be reused when its command scopes do not overlap: the same chord can mean one thing in the editor and another in the result grid, as ⌘D does.

Keymap editor with shortcut presets and grouped action bindings

Update sqlr

Check for updates at startup is on by default. It checks GitHub at most once a day and fails silently when offline. To check on demand, choose Check for updates now in General, or Check for Updates… in Help.

When a release is offered, Install downloads and verifies its checksum. Skip this version suppresses that release in automatic checks; an explicit check can offer it again. On macOS sqlr replaces its application bundle and may request administrator access. On Linux it replaces a writable binary or AppImage. Windows and unwritable Linux installations open the release page. After an installation, use Restart now when offered.

Locate your files

Use Open settings folder in Preferences for the configuration directory. Diagnostics shows the data directory.

DirectoryFiles and contents
Configurationconnections.toml, profiles.toml, settings.toml, overrides.toml, keymap.toml, updates.json
Configurationsecrets.vault, encrypted credentials and MCP token; its key is kept in the OS keychain
Datasqlr.db, containing history, snippets and diagram layouts
Datadrivers/<id>/<version>/, installed sidecar drivers
Datalogs/ and diagnostics/, local logs and incident reports

On macOS both directories default to ~/Library/Application Support/dev.sqlr.sqlr/. Linux uses ~/.config/sqlr/ for configuration and ~/.local/share/sqlr/ for data. The startup options --config-dir and --data-dir select different locations. Moving a vault file alone does not transfer its key or credentials.

Start with alternate directories

The command line selects storage locations before the window opens. It does not run queries. Running sqlr --help prints:

Usage: sqlr [OPTIONS]

Options:
      --data-dir <path>    Keep history, snippets, logs and known hosts in <path>
      --config-dir <path>  Read connections, profiles and settings from <path>
  -V, --version            Print the version
  -h, --help               Print this help

Both --config-dir path and --config-dir=path forms work. Unknown options, missing paths and stray arguments print usage to standard error and exit with code 2.


← Drivers · Agents and terminal →