README
¶
Squix's SQL Stash
SQL Query Stashing for Terminal Squirrels
Bear Grylls: "Out here in the wild database ecosystem, efficiency means survival. See that squirrel? That’s Squix, or Sequillis termius. He doesn’t panic-write queries under pressure. He prepares. He caches. He optimizes. While others are wrestling with joins in the dark, Squix already has his results. Extraordinary creature."
A minimal CLI tool for managing and executing SQL queries across multiple databases. Written in Go, made beautiful with BubbleTea
Quick Start • Configuration • Database Support • Dbeesly • Features • Commands • TUI Navigation • Roadmap • Contributing
This project is currently in beta, please report unexpected behavior through the issues tab
Demo
Highlights
- Query Library - Save and organize your most-used queries
- Runs in the CLI - Execute queries with minimal overhead
- Multi-Database - Works with PostgreSQL, MySQL, SQLite, Oracle, SQL Server, ClickHouse and Firebird
- Table view TUI - Keyboard focused navigation with vim-style bindings
- In-Place Editing - Update cells, delete rows and edit your SQL directly from the results table
- Export your data - Export your data as CSV, JSON, SQL, Markdown or HTML tables
Quick Start
Installation
Go to the releases page and find the correct version for your system. Download it and make sure the file is executable and moved to a directory in your $PATH.
Go install
Use go to install squix directly
go install github.com/eduardofuncao/squix/cmd/squix@latest
this will put the binary squix in your $GOBIN path (usually ~/go/bin)
Build Manually
Follow these instructions to build the project locally
git clone https://github.com/eduardofuncao/squix
go build -o squix ./cmd/squix
The squix binary will be available in the root project directory
Nix / NixOS (Flake)
Squix is available as a Nix flake for easy installation on NixOS and systems with Nix.
Run directly without installing
nix run github:eduardofuncao/squix
Install to user profile
nix profile install github:eduardofuncao/squix
Enter development shell
nix develop github:eduardofuncao/squix
NixOS System-wide
Add to your flake-based configuration.nix or flake.nix:
{
description = "My NixOS config";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
squix.url = "github:eduardofuncao/squix";
};
outputs = { self, nixpkgs, squix, ... }: {
nixosConfigurations.myHostname = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
{
nixpkgs.config.allowUnfree = true;
environment.systemPackages = [
squix.packages.x86_64-linux.default
];
}
];
};
};
}
Then rebuild: sudo nixos-rebuild switch
Home Manager
Add to your home.nix or flake config:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nix-unstable";
squix.url = "github:eduardofuncao/squix";
};
outputs = { self, nixpkgs, squix, ... }: {
homeConfigurations."username" = {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
modules = [
{
nixpkgs.config.allowUnfree = true;
home.packages = [
squix.packages.x86_64-linux.default
];
}
];
};
};
}
Then apply: home-manager switch
Note: Oracle support requires allowUnfree = true in your Nix configuration.
Basic Usage
# Create your first connection (PostgreSQL example)
squix init mydb postgres "postgresql://user:pass@localhost:5432/mydb"
# Add a saved query
squix add list_users "SELECT * FROM users"
# List your saved queries
squix list queries
# Run it, this opens the interactive table viewer
squix run list_users
# Or run inline SQL
squix run "SELECT * FROM products WHERE price > 100"
Navigating the Table
Once your query results appear, you can navigate and interact with the data:
# Use vim-style navigation or arrow-keys
j/k # Move down/up
h/l # Move left/right
g/G # Jump to first/last row
# Copy data
y # Yank (copy) current cell
v # Enter visual mode to select multiple cells and copy with y
x # Export selected data as csv, tsv, json, sql, markdown or html
# Edit data directly
u # Update current cell (opens your $EDITOR)
D # Delete current row
# Modify and re-run
e # Edit the query and re-run it
# Exit
q # Quit back to terminal
Configuration
Squix stores its configuration at ~/.config/squix/config.yaml.
Row Limit default_row_limit: 1000
All queries are automatically limited to prevent fetching massive result sets. Configure via default_row_limit in config or use explicit LIMIT in your SQL queries.
Column Width default_column_width: 15
The width for all columns in the table TUI is fixed to a constant size, which can be configured through default_column_width in the config file. There are plans to make the column widths flexible in future versions.
Color Schemes color_scheme: "default"
Customize the terminal UI colors with built-in schemes:
Available schemes:
default, dracula, gruvbox, solarized, nord, monokai
black-metal, black-metal-gorgoroth, vesper, catppuccin-mocha, tokyo-night, rose-pine, terracotta
Each scheme uses a 7-color palette: Primary (titles, headers), Success (success messages), Error (errors), Normal (table data), Muted (borders, help text), Highlight (selected backgrounds), Accent (keywords, strings).
Database Support
Examples of init/create commands to start working with different database types
PostgreSQL
squix init pg-prod postgres postgres://myuser:mypassword@localhost:5432/mydb?sslmode=disable
# or connect to a specific schema:
squix init pg-prod postgres postgres://myuser:mypassword@localhost:5432/mydb?sslmode=disable schema-name
MySQL / MariaDB
squix init mysql-dev mysql 'myuser:mypassword@tcp(127.0.0.1:3306)/mydb'
squix init mariadb-docker mariadb "root:MyStrongPass123@tcp(localhost:3306)/forestgrove"
SQL Server
squix init sqlserver-docker sqlserver "sqlserver://sa:MyStrongPass123@localhost:1433/master"
SQLite
squix init sqlite-local sqlite file:///home/eduardo/dbeesly/sqlite/mydb.sqlite
Oracle
squix init oracle-stg oracle myuser/mypassword@localhost:1521/XEPDB1
# or connect to a specific schema:
squix init oracle-stg oracle myuser/mypassword@localhost:1521/XEPDB1 schema-name
Make sure you have the Oracle Instant Client or equivalent installed in your system
ClickHouse
squix init clickhouse-docker clickhouse "clickhouse://myuser:mypassword@localhost:9000/forestgrove"
FireBird
squix init firebird-docker firebird user:masterkey@localhost:3050//var/lib/firebird/data/the_office
🐝 Dbeesly
To run containerized test database servers for all supported databases, use the sister project dbeesly
Features
Query Management
Save, organize, and execute your SQL queries with ease.
# Add queries with auto-incrementing IDs
squix add daily_report "SELECT * FROM sales WHERE date = CURRENT_DATE"
squix add user_count "SELECT COUNT(*) FROM users"
squix add employees "SELECT TOP 10 * FROM employees ORDER BY last_name"
# Add parameterized queries with :param|default syntax
squix add emp_by_salary "SELECT * FROM employees WHERE salary > :min_sal|30000"
squix add search_users "SELECT * FROM users WHERE name LIKE :name|P% AND status = :status|active"
# When creating queries with params and not default, squix will prompt you for the param value every time you run the query
squix add search_by_name "SELECT * FROM employees where first_name = :name"
# Run parameterized queries with named parameters (order doesn't matter!)
squix run emp_by_salary --min_sal 50000
squix run search_users --name Michael --status active
# Or use positional args (must match SQL order)
squix run search_users Michael active
# List all saved queries
squix list queries
# Search for specific queries
squix list queries emp # Finds queries with 'emp' in name or SQL
squix list queries employees --oneline # displays each query in one line
# Run by name or ID
squix run daily_report
squix run 2
# Edit query before running (great for testing parameter values)
squix run emp_by_salary --edit
TUI Table Viewer
Navigate query results with Vim-style keybindings, update cells in-place, delete rows and copy data
Key Features:
- Syntax-highlighted SQL display
- Column type indicators
- Primary key markers
- Live cell editing
- Visual selection mode
Connection Switching
Manage multiple database connections and switch between them instantly.
# List all connections
squix list connections
squix switch production
Display current connection and check if it is reachable
squix status
Database Exploration
Explore your database schema and visualize relationships between tables.
# List all tables and views in multi-column format
squix explore
# Query a table directly
squix explore employees --limit 100
# Visualize foreign key relationships
squix explain employees
squix explain employees --depth 2 # Show relationships 2 levels deep
Note: The squix explain command is currently a work in progress and may change in future versions.
Editor Integration
Squix uses your $EDITOR environment variable for editing queries and UPDATE/DELETE statements.
# Set your preferred editor (example in bash)
export EDITOR=vim
export EDITOR=nano
export EDITOR=code
You can also use the editor to edit queries before running them
# Edit existing query before running
squix run daily_report --edit
# Create and run a new query on the fly
squix run
# Re-run the last executed query
squix run --last
# Edit all queries at once
squix edit queries
All Commands
Connection Management
| Command | Description | Example |
|---|---|---|
create <name> <type> <conn-string> [schema] |
Create new database connection | squix create mydb postgres "postgresql://..." |
switch <name> |
Switch to a different connection | squix switch production |
status |
Show current active connection | squix status |
list connections |
List all configured connections | squix list connections |
Query Operations
| Command | Description | Example |
|---|---|---|
add <name> [sql] |
Add a new saved query | squix add users "SELECT * FROM users" |
remove <name|id> |
Remove a saved query | squix remove users or squix remove 3 |
list queries |
List all saved queries | squix list queries |
list queries --oneline |
lists each query in one line | squix list -o |
list queries <searchterm> |
lists queries containing search term | squix list employees |
run <name|id|sql> |
Execute a query | squix run users or squix run 2 |
run |
Create and run a new query | squix run |
run --edit |
Edit query before running | squix run users --edit |
run --last, -l |
Re-run last executed query | squix run --last |
run --param |
run with named params | squix run --name Squix |
Database Exploration
| Command | Description | Example |
|---|---|---|
explore |
List all tables and views in multi-column format | squix explore |
explore <table> [-l N] |
Query a table with optional row limit | squix explore employees --limit 100 |
explain <table> [-d N] [-c] |
Visualize foreign key relationships | squix explain employees --depth 2 |
Info
| Command | Description | Example |
|---|---|---|
info tables |
List all tables from current schema | squix info tables |
info views |
List all views from current schema | squix info views |
Configuration
| Command | Description | Example |
|---|---|---|
config |
Edit main configuration file | squix config |
edit |
Edit all queries for current connection | squix edit |
edit <name|id> |
Edit a single named query | squix edit 3 |
help [command] |
Show help information | squix help run |
TUI Table Navigation
When viewing query results in the TUI, you have full Vim-style navigation and editing capabilities.
Basic Navigation
| Key | Action |
|---|---|
h, ← |
Move left |
j, ↓ |
Move down |
k, ↑ |
Move up |
l, → |
Move right |
g |
Jump to first row |
G |
Jump to last row |
0, _, Home |
Jump to first column |
$, End |
Jump to last column |
Ctrl+u, PgUp |
Page up |
Ctrl+d, PgDown |
Page down |
Data Operations
| Key | Action |
|---|---|
v |
Enter visual selection mode |
y |
Copy selected cell(s) to clipboard |
Enter |
Show cell value in detail view (with JSON formatting) |
u |
Update current cell (opens editor) |
D |
Delete current row (requires WHERE clause) |
e |
Edit and re-run query |
s |
Save current query |
q, Ctrl+c, Esc |
Quit table view |
Detail View Mode
Press Enter on any cell to open a detailed view that shows the full cell content. If the content is valid JSON, it will be automatically formatted with proper indentation.
In Detail View:
| Key | Action |
|---|---|
↑, ↓, j, k |
Scroll through content |
e |
Edit cell content (opens editor with formatted JSON) |
q, Esc, Enter |
Close detail view |
When you press e in detail view:
- The editor opens with the full content (JSON will be formatted)
- Edit the content as needed
- Save and close to update the database
- JSON validation is performed automatically
- The table view updates with the new value
Visual Mode
Press v to enter visual mode, then navigate to select a range of cells.
Press y to copy the selection as plain text, or x to export the selected data as csv, tsv, json, sql insert statement, markdown or html
The copied or exported data will be available in your clipboard
Roadmap
This project is currently in beta, please report unexpected behavior through the issues tab
v0.3.0 - Squix 🐿️
- Edit command overhaul
- Delete connections with remove command
- Full project rename
v0.4.0 - Acorn 🌰
- Shell autocomplete (bash, fish, zsh)
- Encryption on connection username/password in config file
- Dynamic column width
- Duckdb support
- Update to bubbletea v2
Contributing
We welcome contributions! Get started with detailed instructions from CONTRIBUTING.md
Thanks a lot to all the contributors:
Acknowledgments
Squix wouldn't exist without the inspiration and groundwork laid by these fantastic projects:
- naggie/dstask - For the elegant CLI design patterns and file-based data storage approach
- DeprecatedLuar/better-curl-saul - For demonstrating a simple and genius approach to making a CLI tool
- dbeaver - The OG database management tool
Built with:
- Bubble Tea - The TUI framework
- Go standard library and various database drivers
License
MIT License - see LICENSE file for details
Made with 🐿️ by @eduardofuncao
Previously Pam's Database Drawer, thanks to u/marrsd for suggesting the new name!