Skip to content

Commit 4d1be17

Browse files
committed
inital commit
0 parents  commit 4d1be17

File tree

14 files changed

+3070
-0
lines changed

14 files changed

+3070
-0
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.10", "3.11", "3.12", "3.13"]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install build
28+
pip install -e .
29+
30+
- name: Check package builds
31+
run: python -m build
32+
33+
- name: Verify CLI entry point
34+
run: |
35+
python -c "from sqlit.cli import main; print('CLI import OK')"

.github/workflows/publish.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Set up Python
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: "3.12"
17+
18+
- name: Install build tools
19+
run: python -m pip install --upgrade build
20+
21+
- name: Build package
22+
run: python -m build
23+
24+
- name: Upload dist artifacts
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: dist
28+
path: dist/
29+
30+
publish:
31+
needs: build
32+
runs-on: ubuntu-latest
33+
environment: pypi
34+
permissions:
35+
id-token: write # Required for trusted publishing
36+
steps:
37+
- name: Download dist artifacts
38+
uses: actions/download-artifact@v4
39+
with:
40+
name: dist
41+
path: dist/
42+
43+
- name: Publish to PyPI
44+
uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# Distribution / packaging
7+
build/
8+
dist/
9+
*.egg-info/
10+
*.egg
11+
12+
# Virtual environments
13+
venv/
14+
.venv/
15+
16+
# IDE
17+
.idea/
18+
.vscode/
19+
*.swp
20+
*.swo
21+
22+
# OS
23+
.DS_Store

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Peter
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# sqlit
2+
3+
A simple terminal UI for SQL Server, for those who just want to run some queries.
4+
5+
![Python](https://img.shields.io/badge/python-3.10+-blue.svg)
6+
![License](https://img.shields.io/badge/license-MIT-green.svg)
7+
8+
<!-- ![Demo](demo.gif) -->
9+
10+
You know that mass of software that is SSMS? You open it up and wait... and wait... just to run a simple SELECT query. Meanwhile it's eating up your RAM like there's no tomorrow.
11+
12+
And if you're on Linux? Your only option has been a VS Code extension. Seriously?
13+
14+
All you want is to connect to a database, browse some tables, and run a query. That's it. You don't need the 47 features you've never touched.
15+
16+
sqlit is a lightweight SQL Server client that shows you what you can do at all times. No memorizing keybindings. No digging through menus. Just connect and query.
17+
18+
## Features
19+
20+
- Browse databases, tables, views, and stored procedures
21+
- Execute SQL queries with syntax highlighting
22+
- Vim-style modal editing (because you're in a terminal)
23+
- SQL autocomplete for tables, columns, and procedures
24+
- Multiple authentication methods (Windows, SQL Server, Entra ID)
25+
- Save and manage connections
26+
- CLI mode for scripting and AI agents
27+
- Themes (Tokyo Night, Nord, and more)
28+
- Auto-detects and installs ODBC drivers
29+
30+
## Installation
31+
32+
```bash
33+
pip install sqlit-tui
34+
```
35+
36+
That's it. When you first run sqlit, it will detect if you're missing ODBC drivers and help you install them for your OS (Ubuntu, Fedora, Arch, macOS, etc).
37+
38+
## Usage
39+
40+
```bash
41+
sqlit
42+
```
43+
44+
The keybindings are shown at the bottom of the screen.
45+
46+
### CLI
47+
48+
```bash
49+
# Run a query
50+
sqlit query -c "MyServer" -q "SELECT * FROM Users"
51+
52+
# Output as CSV or JSON
53+
sqlit query -c "MyServer" -q "SELECT * FROM Users" --format csv
54+
sqlit query -c "MyServer" -f "script.sql" --format json
55+
56+
# Manage connections
57+
sqlit connection list
58+
sqlit connection create --name "MyServer" --server "localhost" --auth-type sql
59+
sqlit connection delete "MyServer"
60+
```
61+
62+
## Keybindings
63+
64+
| Key | Action |
65+
|-----|--------|
66+
| `i` | Enter INSERT mode |
67+
| `Esc` | Back to NORMAL mode |
68+
| `e` / `q` / `r` | Focus Explorer / Query / Results |
69+
| `s` | SELECT TOP 100 from table |
70+
| `Ctrl+P` | Command palette |
71+
| `Ctrl+Q` | Quit |
72+
| `?` | Help |
73+
74+
Autocomplete triggers automatically in INSERT mode. Use `Tab` to accept.
75+
76+
You can also receive autocompletion on columns by typing the table name and hitting "."
77+
78+
## Configuration
79+
80+
Connections and settings are stored in `~/.sqlit/`.
81+
82+
## License
83+
84+
MIT

pyproject.toml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "sqlit-tui"
7+
version = "0.1.0"
8+
description = "A terminal UI for SQL Server"
9+
readme = "README.md"
10+
license = "MIT"
11+
requires-python = ">=3.10"
12+
authors = [
13+
{ name = "Peter" }
14+
]
15+
keywords = ["sql", "server", "tui", "database", "mssql", "terminal"]
16+
classifiers = [
17+
"Development Status :: 4 - Beta",
18+
"Environment :: Console",
19+
"Intended Audience :: Developers",
20+
"License :: OSI Approved :: MIT License",
21+
"Operating System :: OS Independent",
22+
"Programming Language :: Python :: 3",
23+
"Programming Language :: Python :: 3.10",
24+
"Programming Language :: Python :: 3.11",
25+
"Programming Language :: Python :: 3.12",
26+
"Programming Language :: Python :: 3.13",
27+
"Topic :: Database",
28+
]
29+
dependencies = [
30+
"textual[syntax]>=0.50.0",
31+
"pyodbc>=5.0.0",
32+
]
33+
34+
[project.scripts]
35+
sqlit = "sqlit.cli:main"
36+
37+
[project.urls]
38+
Homepage = "https://github.com/Maxteabag/sqlit"
39+
Repository = "https://github.com/Maxteabag/sqlit"
40+
Issues = "https://github.com/Maxteabag/sqlit/issues"
41+
42+
[tool.hatch.build.targets.wheel]
43+
packages = ["sqlit"]

sqlit/__init__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""sqlit - A terminal UI for SQL Server."""
2+
3+
__version__ = "0.1.0"
4+
__author__ = "Peter"
5+
6+
from .cli import main
7+
from .app import SSMSTUI
8+
from .config import AuthType, ConnectionConfig
9+
10+
__all__ = [
11+
"main",
12+
"SSMSTUI",
13+
"AuthType",
14+
"ConnectionConfig",
15+
]

0 commit comments

Comments
 (0)