Skip to content

Commit 35d8ba5

Browse files
authored
Firebird support (#18)
* Firebird support * Initial stab at a test suite * Guarantee commits * Fix failing primary key test * Dummy methods to get the tests mostly passing again * Configure a sequence, trigger, and index * Implementations for everything other than indexes * Index support * Don't allow system indices to leak out * Update docs * Fixes * Fix docker detection
1 parent 07a50af commit 35d8ba5

File tree

14 files changed

+726
-6
lines changed

14 files changed

+726
-6
lines changed

.github/workflows/ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ jobs:
6565
--ignore=tests/test_duckdb.py \
6666
--ignore=tests/test_cockroachdb.py \
6767
--ignore=tests/test_turso.py \
68+
--ignore=tests/test_firebird.py \
6869
--ignore=tests/test_ssh.py \
6970
--ignore=tests/test_clickhouse.py
7071
@@ -401,6 +402,44 @@ jobs:
401402
run: |
402403
pytest tests/test_cockroachdb.py -v --timeout=120
403404
405+
test-firebird:
406+
runs-on: ubuntu-latest
407+
needs: build
408+
409+
services:
410+
firebird:
411+
image: firebirdsql/firebird:5.0.3-noble
412+
env:
413+
FIREBIRD_USER: testuser
414+
FIREBIRD_PASSWORD: TestPassword123!
415+
FIREBIRD_DATABASE: /var/lib/firebird/data/test_sqlit.fdb
416+
ports:
417+
- 3050:3050
418+
419+
steps:
420+
- uses: actions/checkout@v4
421+
422+
- name: Set up Python 3.12
423+
uses: actions/setup-python@v5
424+
with:
425+
python-version: "3.12"
426+
427+
- name: Install dependencies
428+
run: |
429+
python -m pip install --upgrade pip
430+
pip install -e ".[test]"
431+
pip install firebirdsql
432+
433+
- name: Run Firebird integration tests
434+
env:
435+
FIREBIRD_HOST: localhost
436+
FIREBIRD_PORT: 3050
437+
FIREBIRD_USER: testuser
438+
FIREBIRD_PASSWORD: TestPassword123!
439+
FIREBIRD_DATABASE: /var/lib/firebird/data/test_sqlit.fdb
440+
run: |
441+
pytest tests/test_firebird.py -v --timeout=120
442+
404443
test-clickhouse:
405444
runs-on: ubuntu-latest
406445
needs: build

CONTRIBUTING.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pytest tests/ -v -k sqlite
2727

2828
### Full Test Suite (Requires Docker)
2929

30-
To run the complete test suite including SQL Server, PostgreSQL, MySQL, MariaDB, Oracle, DuckDB, and CockroachDB tests:
30+
To run the complete test suite including SQL Server, PostgreSQL, MySQL, MariaDB, FirebirdSQL, Oracle, DuckDB, and CockroachDB tests:
3131

3232
1. Start the test database containers:
3333
```bash
@@ -53,6 +53,7 @@ pytest tests/ -v -k mssql # SQL Server only
5353
pytest tests/ -v -k PostgreSQL # PostgreSQL only
5454
pytest tests/ -v -k MySQL # MySQL only
5555
pytest tests/ -v -k cockroach # CockroachDB only
56+
pytest tests/ -v -k firebird # FirebirdSQL only
5657
```
5758

5859
### Environment Variables
@@ -94,6 +95,15 @@ The database tests can be configured with these environment variables:
9495
| `COCKROACHDB_PASSWORD` | `` | CockroachDB password (empty for the included Docker container) |
9596
| `COCKROACHDB_DATABASE` | `test_sqlit` | CockroachDB database |
9697

98+
**FirebirdSQL:**
99+
| Variable | Default | Description |
100+
|----------|---------|-------------|
101+
| `FIREBIRD_HOST` | `localhost` | Firebird hostname |
102+
| `FIREBIRD_PORT` | `3050` | Firebird port |
103+
| `FIREBIRD_USER` | `testuser` | Firebird username |
104+
| `FIREBIRD_PASSWORD` | `TestPassword123!` | Firebird password |
105+
| `FIREBIRD_DATABASE` | `/var/lib/firebird/data/test_sqlit.fdb` | Firebird database path or alias |
106+
97107
### CockroachDB Quickstart (Docker)
98108

99109
1. Start the included CockroachDB container:
@@ -204,6 +214,7 @@ Rationale: E;Q;R satisfies both intuitiveness (each binding is the first letter
204214

205215
- **PostgreSQL Tests**: Runs PostgreSQL integration tests with Docker service
206216
- **MySQL Tests**: Runs MySQL integration tests with Docker service
217+
- **Firebird Tests**: Runs Firebird integration tests with Docker service
207218
- **MariaDB/Oracle/DuckDB/CockroachDB Tests**: Runs the remaining database integration tests with Docker service where applicable
208219
- **Full Test Suite**: Runs all tests across every supported database
209220

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# sqlit
22

3-
**The lazygit of SQL databases.** Connect to Postgres, MySQL, SQL Server, SQLite, ClickHouse, Supabase, Turso, and more from your terminal in seconds.
3+
**The lazygit of SQL databases.** Connect to Postgres, MySQL, SQL Server, SQLite, ClickHouse, FirebirdSQL, Supabase, Turso, and more from your terminal in seconds.
44

55
A lightweight TUI for people who just want to run some queries fast.
66

@@ -23,7 +23,7 @@ A lightweight TUI for people who just want to run some queries fast.
2323

2424
- **Connection manager UI** - Save connections, switch between databases without CLI args
2525
- **Just run `sqlit`** - No CLI config needed, pick a connection and go
26-
- **Multi-database out of the box** - SQL Server, PostgreSQL, MySQL, SQLite, MariaDB, Oracle, DuckDB, CockroachDB, ClickHouse, Supabase, Turso - no adapters to install
26+
- **Multi-database out of the box** - SQL Server, PostgreSQL, MySQL, SQLite, MariaDB, FirebirdSQL, Oracle, DuckDB, CockroachDB, ClickHouse, Supabase, Turso - no adapters to install
2727
- Connect directly to database docker container
2828
- **SSH tunnels built-in** - Connect to remote databases securely with password or key auth
2929
- **Vim-style editing** - Modal editing for terminal purists
@@ -48,7 +48,7 @@ The problem got severely worse when I switched to Linux and had to rely on VS CO
4848

4949
I tried to use some existing TUI's for SQL, but they were not intuitive for me and I missed the immediate ease of use that other TUI's such as Lazygit provides.
5050

51-
sqlit is a lightweight database TUI that is easy to use and beautiful to look at, just connect and query. It's for you that just wants to run queries toward your database without launching applications that eats your ram and takes time to load up. Sqlit supports SQL Server, PostgreSQL, MySQL, SQLite, MariaDB, Oracle, DuckDB, CockroachDB, ClickHouse, Supabase, and Turso, and is designed to make it easy and enjoyable to access your data, not painful.
51+
sqlit is a lightweight database TUI that is easy to use and beautiful to look at, just connect and query. It's for you that just wants to run queries toward your database without launching applications that eats your ram and takes time to load up. Sqlit supports SQL Server, PostgreSQL, MySQL, SQLite, MariaDB, FirebirdSQL, Oracle, DuckDB, CockroachDB, ClickHouse, Supabase, and Turso, and is designed to make it easy and enjoyable to access your data, not painful.
5252

5353

5454
## Installation
@@ -103,6 +103,7 @@ sqlit connections add mysql --name "MyMySQL" --server "localhost" --username "us
103103
sqlit connections add cockroachdb --name "MyCockroach" --server "localhost" --port "26257" --database "defaultdb" --username "root"
104104
sqlit connections add sqlite --name "MyLocalDB" --file-path "/path/to/database.db"
105105
sqlit connections add turso --name "MyTurso" --server "libsql://your-db.turso.io" --password "your-auth-token"
106+
sqlit connections add firebird --name "MyFirebird" --server "localhost" --username "user" --password "pass" --database "employee"
106107

107108
# Connect via SSH tunnel
108109
sqlit connections add postgresql --name "RemoteDB" --server "db-host" --username "dbuser" --password "dbpass" \
@@ -210,6 +211,7 @@ Most of the time you can just run `sqlit` and connect. If a Python driver is mis
210211
| ClickHouse | `clickhouse-connect` | `pipx inject sqlit-tui clickhouse-connect` | `python -m pip install clickhouse-connect` |
211212
| Turso | `libsql-client` | `pipx inject sqlit-tui libsql-client` | `python -m pip install libsql-client` |
212213
| Cloudflare D1 | `requests` | `pipx inject sqlit-tui requests` | `python -m pip install requests` |
214+
| Firebird | `firebirdsql` | `pip install firebirdsql` | `python -m pip install firebirdsql` |
213215

214216
**Note:** SQL Server also requires the platform-specific ODBC driver. On your first connection attempt, `sqlit` can help you install it if it's missing.
215217

docker-compose.test.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,26 @@ services:
112112
retries: 10
113113
start_period: 10s
114114

115+
firebird:
116+
image: firebirdsql/firebird:5.0.3-noble
117+
container_name: sqlit-test-firebird
118+
environment:
119+
FIREBIRD_USER: "testuser"
120+
FIREBIRD_PASSWORD: "TestPassword123!"
121+
FIREBIRD_DATABASE: "/var/lib/firebird/data/test_sqlit.fdb"
122+
ports:
123+
- "3050:3050"
124+
healthcheck:
125+
# Firebird doesn't come with a straightforward health check, but this
126+
# ought to be enough, I hope...
127+
test: ["CMD", "nc", "-vz", "localhost", "3050"]
128+
interval: 5s
129+
timeout: 5s
130+
retries: 10
131+
start_period: 10s
132+
tmpfs:
133+
- /var/lib/firebird/data
134+
115135
# SSH server for testing SSH tunnel connections
116136
# Connects to postgres container on docker network
117137
ssh:

pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ build-backend = "hatchling.build"
55
[project]
66
name = "sqlit-tui"
77
version = "0.5.1"
8-
description = "A terminal UI for SQL Server, PostgreSQL, MySQL, SQLite, and Oracle"
8+
description = "A terminal UI for SQL Server, PostgreSQL, MySQL, SQLite, Oracle, and more"
99
readme = "README.md"
1010
license = "MIT"
1111
requires-python = ">=3.10"
1212
authors = [
1313
{ name = "Peter" }
1414
]
15-
keywords = ["sql", "server", "tui", "database", "mssql", "postgresql", "mysql", "sqlite", "oracle", "terminal"]
15+
keywords = ["sql", "server", "tui", "database", "mssql", "postgresql", "mysql", "sqlite", "oracle", "firebird", "terminal"]
1616
classifiers = [
1717
"Development Status :: 4 - Beta",
1818
"Environment :: Console",
@@ -45,6 +45,7 @@ all = [
4545
"clickhouse-connect>=0.7.0",
4646
"requests>=2.32.4", # min avoids known CVEs
4747
"libsql-client>=0.1.0",
48+
"firebirdsql>=1.3.5",
4849
"sshtunnel>=0.4.0",
4950
"paramiko>=2.0.0,<4.0.0",
5051
]
@@ -58,6 +59,7 @@ duckdb = ["duckdb>=1.1.0"] # min avoids known CVEs
5859
clickhouse = ["clickhouse-connect>=0.7.0"]
5960
d1 = ["requests>=2.32.4"] # min avoids known CVEs
6061
turso = ["libsql-client>=0.1.0"]
62+
firebird = ["firebirdsql>=1.3.5"]
6163
ssh = [
6264
"sshtunnel>=0.4.0",
6365
"paramiko>=2.0.0,<4.0.0",
@@ -112,6 +114,7 @@ markers = [
112114
"postgresql: PostgreSQL database tests",
113115
"mysql: MySQL database tests",
114116
"oracle: Oracle database tests",
117+
"firebird: Firebird database tests",
115118
"clickhouse: ClickHouse database tests",
116119
"asyncio: async tests",
117120
"integration: integration tests (may require external services)",

sqlit/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ class DatabaseType(str, Enum):
112112
SUPABASE = "supabase"
113113
TURSO = "turso"
114114
D1 = "d1"
115+
FIREBIRD = "firebird"
115116

116117
else:
117118
DatabaseType = Enum("DatabaseType", {t.upper(): t for t in _get_supported_db_types()}) # type: ignore[misc]

sqlit/db/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
# Adapters (lazy via __getattr__)
4141
"CockroachDBAdapter",
4242
"DuckDBAdapter",
43+
"FirebirdAdapter",
4344
"MariaDBAdapter",
4445
"MySQLAdapter",
4546
"OracleAdapter",
@@ -56,6 +57,7 @@
5657
if TYPE_CHECKING:
5758
from .adapters.cockroachdb import CockroachDBAdapter
5859
from .adapters.duckdb import DuckDBAdapter
60+
from .adapters.firebird import FirebirdAdapter
5961
from .adapters.mariadb import MariaDBAdapter
6062
from .adapters.mssql import SQLServerAdapter
6163
from .adapters.mysql import MySQLAdapter
@@ -88,6 +90,7 @@ def get_all_schemas() -> Any:
8890
# Adapters (through sqlit.db.adapters, which itself lazy-loads)
8991
"CockroachDBAdapter": ("sqlit.db.adapters", "CockroachDBAdapter"),
9092
"DuckDBAdapter": ("sqlit.db.adapters", "DuckDBAdapter"),
93+
"FirebirdAdapter": ("sqlit.db.adapters", "FirebirdAdapter"),
9194
"MariaDBAdapter": ("sqlit.db.adapters", "MariaDBAdapter"),
9295
"MySQLAdapter": ("sqlit.db.adapters", "MySQLAdapter"),
9396
"OracleAdapter": ("sqlit.db.adapters", "OracleAdapter"),

sqlit/db/adapters/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"ClickHouseAdapter",
2323
"CockroachDBAdapter",
2424
"DuckDBAdapter",
25+
"FirebirdAdapter",
2526
"MariaDBAdapter",
2627
"MySQLAdapter",
2728
"OracleAdapter",
@@ -39,6 +40,7 @@
3940
from .clickhouse import ClickHouseAdapter
4041
from .cockroachdb import CockroachDBAdapter
4142
from .duckdb import DuckDBAdapter
43+
from .firebird import FirebirdAdapter
4244
from .mariadb import MariaDBAdapter
4345
from .mssql import SQLServerAdapter
4446
from .mysql import MySQLAdapter

0 commit comments

Comments
 (0)