Skip to content

Latest commit

 

History

History
118 lines (78 loc) · 3.6 KB

sessions.md

File metadata and controls

118 lines (78 loc) · 3.6 KB

Sessions

A session captures the full working state of TableViewer:

  • Opened files (paths, aliases, filetypes, delimiters, jaq filters)
  • Current SQL query
  • Query history and pinned queries
  • Notes

Sessions are stored per-profile in a local SQLite database (sessions.db).


Session Manager

Open via Gear → Sessions → Manager (or ⌘S shortcut).

Save a session

  1. Click 💾 Save — enter a name and confirm
  2. The session is saved and becomes the active session

Update the current session

If a session is active (name shown in the manager header), click Update to overwrite it with the current state. This is the equivalent of "Ctrl+S" in an editor.

Load a session

Click any session in the list. If the session references local files that no longer exist, a Session Warning dialog appears (see below).

Delete a session

Click ✕ next to a session name.


Quick save / load

Gear menu action Description
Sessions → Save as… Save current state under a new name without opening the full manager
Sessions → Load from… Import a .tar.gz archive directly
Sessions → Export as… Export the current in-memory state as a .tar.gz archive

Session archives (.tar.gz)

Session archives let you share sessions across machines or back them up.

What is included

Item Included
Session metadata (SQL, history, pinned queries, notes) ✅
Copies of referenced local files ✅
Profile preferences ✅
Remote file URLs ✅ (URL only — credentials are not included)

Export

  1. In the Session Manager, click Export next to a session — saves that saved session's archive.
  2. Or: Gear → Sessions → Export as… — exports the current unsaved state immediately.

Both open a file-save dialog and write a .tar.gz file.

Import

Gear → Sessions → Load from… opens a file-pick dialog for .tar.gz / .tgz files.

On import:

  1. Local files from the archive are extracted to a temp directory
  2. File paths are updated to point to the extracted copies
  3. The session state is restored (SQL, history, pinned queries, notes)
  4. The Session Warning dialog appears if any issues are detected

Auto-save

TableViewer automatically saves the current state as a "last session" whenever you execute a query. On startup it restores this last session silently.


Session warnings

When loading a session (from the manager, from an archive, or from Spaces), TableViewer validates the state:

Check Warning
Local file path does not exist "File not found: /path/to/file (alias: X)"
Unknown filetype "Unknown filetype 'xyz' for alias 'X'"
Invalid jaq filter "Invalid jaq filter for alias 'X': …"

Options

  • Skip missing files — loads the session but removes entries whose files cannot be found
  • Proceed anyway — loads the session as-is; DuckDB will error when you try to query missing files

Session schema

interface SessionState {
  files: Array<{
    paths:     string[]     // local paths or remote URLs
    alias:     string       // SQL table name
    filetype:  string       // 'parquet' | 'csv' | 'json' | …
    sep:       string       // CSV separator character
    jaqFilter: string       // jq filter string, '' or '.' = none
  }>
  sql:           string         // current SQL bar content
  queryHistory:  string[]       // last ≤10 queries
  pinnedQueries: PinnedQuery[]  // { id, name, sql }
  notes:         Note[]         // { id, title, content, created_at, updated_at }
}