minesql
A MySQL terminal that only suggests the next SQL piece.
- Gray "ghost" text after your cursor = the current best suggestion
Tab— accept the suggestionShift+Tab— show the next-best suggestionCtrl+T— toggle NEXT-piece mode ↔ FULL inline mode (whole query predicted)Ctrl+O— suggestions ON/OFF (OFF is the default at startup)Ctrl+Space— LIST mode ON/OFF: a live suggestion dropdown that stays open and updates as you type until you toggle it off (works even when ghost suggestions are OFF).Alt+Lis an alias ifCtrl+Spaceis grabbed by your terminal/OS.Alt+/— force ONE suggestion right here, right now (any cursor position)- FULL mode:
Tabaccepts ONE word,Ctrl+E(orCtrl+Tab, if your terminal sends it) accepts the WHOLE suggestion Enter— run the queryCtrl+D— exit
Suggestions are schema-aware: database, table, and column names (plus sample
values) come straight from the live MySQL server via information_schema. A
small n-gram model learns from the queries you run (saved in
~/.minesql_model.json) and re-ranks suggestions so your habits float to
the top.
Install
pip install minesql
Usage
minesql -H 127.0.0.1 -u root -d mydb
usage: minesql [-h] [-H HOST] [-P PORT] [-u USER] [-p PASSWORD] [-d DATABASE]
[--suggest] [--full] [--no-confirm] [--no-values]
MySQL terminal with schema-aware ghost-text SQL suggestions.
options:
-h, --help show this help message and exit
-H HOST, --host HOST
-P PORT, --port PORT
-u USER, --user USER
-p PASSWORD, --password PASSWORD
-d DATABASE, --database DATABASE
database to start in
--suggest start with suggestions ON (default is OFF)
--full start with FULL inline suggestions ON
--no-confirm don't ask before DELETE/UPDATE without WHERE, DROP, TRUNCATE
--no-values don't sample column values for suggestions (faster on huge tables)
Examples
minesql -u root -d shop
minesql -H db.example.com -P 3307 -u app --full
Keys (full reference)
| Key | Action |
|---|---|
Tab |
accept the gray suggestion (in FULL mode: just the next word/unit) |
Ctrl+E |
accept the WHOLE suggestion (also Ctrl+Tab on terminals that send it, e.g. kitty, WezTerm, iTerm2, xterm with modifyOtherKeys) |
Shift+Tab |
cycle to the next-best suggestion |
Ctrl+O |
suggestions ON/OFF (OFF by default; start ON with --suggest or --full) |
Ctrl+Space / Alt+L |
LIST mode ON/OFF — a live dropdown of suggestions (with type labels: keyword/table/column/value/snippet) that stays open and updates as you type until toggled off. Works even while ghost suggestions are OFF. Tab/Shift+Tab move in the list, Enter picks the highlighted item (it does not run the query). |
Alt+/ |
force ONE suggestion at the cursor right now (ghost at end of line, dropdown mid-line), even while OFF |
Ctrl+T |
switch suggestion mode NEXT ↔ FULL (also turns suggestions on) |
| Right arrow | accept without the trailing space |
| Up/Down | command history |
Enter |
run query |
Ctrl+C |
cancel line |
Ctrl+D |
exit |
In-app commands
\help show the in-app help
\full toggle FULL/NEXT mode (turns suggestions on)
\suggest toggle suggestions ON/OFF
\list toggle LIST mode
\q / exit / quit leave
Safety
DELETE/UPDATE without WHERE, DROP, and TRUNCATE ask for confirmation
first (disable with --no-confirm).
Modes
- NEXT — suggests only the next keyword / table / column / value.
- FULL — chains predictions into a whole query. Optional clauses
(
WHERE,AND,ORDER BY,LIMIT, ...) are only added once the model has learned you use them after that context. Sample values are guesses — edit them.
Suggestion sources
Live schema (SHOW DATABASES, information_schema), sample column values,
and an n-gram model learned from your queries (~/.minesql_model.json).
Requirements
- Python 3.8+
prompt_toolkitPyMySQL
These are installed automatically with pip install minesql.
Development
git clone https://github.com/IMApurbo/minesql.git
cd minesql
pip install -e .
minesql --help
License
MIT © IMApurbo
Metadata
Release files for minesql 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| minesql-0.1.0.tar.gz | 18.1 kB | Without provenance | Details for minesql-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| minesql-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for minesql-0.1.0-py3-none-any.whl |
Total release size: 35.2 kB
Release files / minesql-0.1.0.tar.gz
| Download URL | minesql-0.1.0.tar.gz |
|---|---|
| Size | 18.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d3c2005710c16745f22da117205ef8f2e36ddaec1805397be2a7d8ab4d8289d7
|
|
BLAKE2b-256 checksum How to use checksums |
6a16a1f85b23c24c46e09081ef16b04070e3dcb9a075701f6c631abd7a2661e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.7
|
Release files / minesql-0.1.0-py3-none-any.whl
| Download URL | minesql-0.1.0-py3-none-any.whl |
|---|---|
| Size | 17.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9dec0cbd7be9b998696b457d609903a77dd20fe2876b90821457ce92209c7c1f
|
|
BLAKE2b-256 checksum How to use checksums |
3159152728a2674e42c853471f857b8cab0862339e933186fed2b1c820b48848
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.7
|
Security for minesql 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.