harlequin-sqlite-ssh 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- harlequin_sqlite_ssh/__init__.py +12 -0
- harlequin_sqlite_ssh/_agent.py +693 -0
- harlequin_sqlite_ssh/adapter.py +362 -0
- harlequin_sqlite_ssh/cli_options.py +105 -0
- harlequin_sqlite_ssh/errors.py +71 -0
- harlequin_sqlite_ssh/locations.py +219 -0
- harlequin_sqlite_ssh/py.typed +0 -0
- harlequin_sqlite_ssh/remote.py +359 -0
- harlequin_sqlite_ssh/transport.py +723 -0
- harlequin_sqlite_ssh-0.1.0.dist-info/METADATA +164 -0
- harlequin_sqlite_ssh-0.1.0.dist-info/RECORD +14 -0
- harlequin_sqlite_ssh-0.1.0.dist-info/WHEEL +4 -0
- harlequin_sqlite_ssh-0.1.0.dist-info/entry_points.txt +2 -0
- harlequin_sqlite_ssh-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: harlequin-sqlite-ssh
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Harlequin adapter for SQLite databases, on this machine or on remote hosts over SSH.
|
|
5
|
+
Project-URL: Repository, https://github.com/lexo13/harlequin-sqlite-ssh
|
|
6
|
+
Project-URL: Issues, https://github.com/lexo13/harlequin-sqlite-ssh/issues
|
|
7
|
+
Project-URL: Changelog, https://github.com/lexo13/harlequin-sqlite-ssh/blob/main/CHANGELOG.md
|
|
8
|
+
Project-URL: Documentation, https://github.com/lexo13/harlequin-sqlite-ssh/tree/main/docs
|
|
9
|
+
Author: lexo13
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: database,harlequin,sql,sqlite,ssh,tui
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Operating System :: POSIX
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Topic :: Database :: Front-Ends
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Requires-Dist: harlequin<3,>=2.18.0
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# harlequin-sqlite-ssh
|
|
24
|
+
|
|
25
|
+
A [Harlequin](https://harlequin.sh) adapter for SQLite databases, on this
|
|
26
|
+
machine or on a remote host over SSH.
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
harlequin -a sqlite-ssh ./local.db
|
|
30
|
+
harlequin -a sqlite-ssh ssh://deploy@db.example.com/srv/app/app.db
|
|
31
|
+
harlequin -a sqlite-ssh db.example.com:app/app.db
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
[Version française](docs/fr/guide-utilisateur.md)
|
|
35
|
+
|
|
36
|
+
## Why
|
|
37
|
+
|
|
38
|
+
SQLite is a file, not a server: there is no port to connect to, so a database
|
|
39
|
+
that lives on a server is usually copied to your machine before you can open
|
|
40
|
+
it in Harlequin. This adapter opens it where it is instead. It runs `ssh`,
|
|
41
|
+
starts a small agent with the server's own `python3`, and sends your queries
|
|
42
|
+
to it. Nothing is installed or written on the server, and no port is opened.
|
|
43
|
+
|
|
44
|
+
Local databases behave exactly as with Harlequin's built-in `sqlite` adapter:
|
|
45
|
+
this adapter is that adapter, with a remote mode added.
|
|
46
|
+
|
|
47
|
+
## Features
|
|
48
|
+
|
|
49
|
+
- Local files, `:memory:` and `file:` URIs, exactly as with `-a sqlite`.
|
|
50
|
+
- Remote files over SSH, with every feature of the local adapter: queries,
|
|
51
|
+
data catalog, catalog search, autocompletion, `--read-only`, connection
|
|
52
|
+
modes, attached databases, extensions, init scripts, transaction modes and
|
|
53
|
+
query cancellation.
|
|
54
|
+
- Configuration in `harlequin.toml` profiles, like any other adapter.
|
|
55
|
+
- Works with your `~/.ssh/config`: host aliases, keys, `ProxyJump`,
|
|
56
|
+
`ControlMaster`.
|
|
57
|
+
- Works with `hsql`, Harlequin's non-interactive CLI.
|
|
58
|
+
|
|
59
|
+
## Requirements
|
|
60
|
+
|
|
61
|
+
- Harlequin 2.18 or later, on Python 3.10 or later.
|
|
62
|
+
- The `ssh` client on your `PATH`.
|
|
63
|
+
- On the remote host: an SSH server, `python3` 3.8 or later with its standard
|
|
64
|
+
`sqlite3` module, and a POSIX shell (sh, bash, zsh, dash...).
|
|
65
|
+
- Authentication that needs no prompt: a key without a passphrase, an
|
|
66
|
+
`ssh-agent`, or an open `ControlMaster` connection. Harlequin owns the
|
|
67
|
+
terminal, so `ssh` cannot ask you for anything.
|
|
68
|
+
|
|
69
|
+
## Installation
|
|
70
|
+
|
|
71
|
+
With [uv](https://docs.astral.sh/uv/), install Harlequin together with the
|
|
72
|
+
adapter (add your other adapters with more `--with` options):
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
uv tool install harlequin --with harlequin-sqlite-ssh
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
With pip, in the environment where Harlequin is installed:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pip install harlequin-sqlite-ssh
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Check that Harlequin sees it: `harlequin --version` lists `sqlite-ssh` among
|
|
85
|
+
the installed adapters.
|
|
86
|
+
|
|
87
|
+
## Quick start
|
|
88
|
+
|
|
89
|
+
1. Check that SSH works without a prompt:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
ssh -o BatchMode=yes deploy@db.example.com python3 --version
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
2. Open the database:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
harlequin -a sqlite-ssh ssh://deploy@db.example.com/srv/app/app.db
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
3. Or save it as a profile in `harlequin.toml`:
|
|
102
|
+
|
|
103
|
+
```toml
|
|
104
|
+
[profiles.app-prod]
|
|
105
|
+
adapter = "sqlite-ssh"
|
|
106
|
+
conn_str = ["ssh://deploy@db.example.com/srv/app/app.db"]
|
|
107
|
+
read_only = true
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
and run `harlequin -P app-prod`.
|
|
111
|
+
|
|
112
|
+
## Connection strings
|
|
113
|
+
|
|
114
|
+
| Connection string | Opens |
|
|
115
|
+
|---|---|
|
|
116
|
+
| `app.db`, `/srv/app.db`, `./host:file.db` | a local file |
|
|
117
|
+
| `:memory:`, `file:app.db?mode=ro` | a local in-memory database, a local SQLite URI |
|
|
118
|
+
| `ssh://[user@]host[:port]/srv/app.db` | `/srv/app.db` on `host` |
|
|
119
|
+
| `ssh://host/~/app.db` | `app.db` in the remote home directory |
|
|
120
|
+
| `[user@]host:/srv/app.db` | `/srv/app.db` on `host` (scp style) |
|
|
121
|
+
| `host:app.db` | `app.db` in the remote home directory |
|
|
122
|
+
| `host:file:/srv/app.db?mode=ro` | a SQLite URI, on `host` |
|
|
123
|
+
|
|
124
|
+
`host` may be an alias from `~/.ssh/config`. Several databases can be opened
|
|
125
|
+
in one session (the first is `main`, the others are attached), as long as they
|
|
126
|
+
are all local or all on the same host.
|
|
127
|
+
|
|
128
|
+
## Options
|
|
129
|
+
|
|
130
|
+
Every option of the `sqlite` adapter works the same way (`--read-only`,
|
|
131
|
+
`--mode`, `--init-path`, `--extension`...). Three options are added:
|
|
132
|
+
|
|
133
|
+
| CLI option | `harlequin.toml` key | Default | Meaning |
|
|
134
|
+
|---|---|---|---|
|
|
135
|
+
| `--remote-python` | `remote_python` | `python3` | The Python to run on the remote host |
|
|
136
|
+
| `--remote-ssh-option` (repeatable) | `remote_ssh_option` (list) | none | `ssh -o` options, e.g. `IdentityFile=~/.ssh/id_db` |
|
|
137
|
+
| `--remote-timeout` | `remote_timeout` | `60` | Seconds to wait for the connection |
|
|
138
|
+
|
|
139
|
+
They are named `remote_*` because Harlequin reserves the `ssh_*` keys for
|
|
140
|
+
its own SSH tunnels, which serve network databases and do not apply here.
|
|
141
|
+
|
|
142
|
+
## Documentation
|
|
143
|
+
|
|
144
|
+
- [User guide](docs/en/user-guide.md): configuration, authentication,
|
|
145
|
+
security, troubleshooting, and how it works.
|
|
146
|
+
- [Guide utilisateur (français)](docs/fr/guide-utilisateur.md).
|
|
147
|
+
|
|
148
|
+
## Development
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
uv sync
|
|
152
|
+
make check # ruff, mypy, unit tests
|
|
153
|
+
make e2e # end-to-end tests over ssh to localhost
|
|
154
|
+
make agent-compat # unit tests with the remote agent on Python 3.8
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Releasing: run the "Create Release Branch" workflow with the new version,
|
|
158
|
+
merge the pull request it prepares, tag the merge commit `vX.Y.Z`, then run
|
|
159
|
+
`gh workflow run publish.yml --ref main -f tag=vX.Y.Z` and approve the
|
|
160
|
+
`publish` environment.
|
|
161
|
+
|
|
162
|
+
## License
|
|
163
|
+
|
|
164
|
+
MIT
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
harlequin_sqlite_ssh/__init__.py,sha256=QiM9z3i9vw_few0FdJaPZSwJmZ5NjKryqe8DT9WcYQI,413
|
|
2
|
+
harlequin_sqlite_ssh/_agent.py,sha256=ReJe5iG06ycC-12hDA7TOQdvIASY5ZlUacflI_vDzyU,25936
|
|
3
|
+
harlequin_sqlite_ssh/adapter.py,sha256=QjkZOzdOP9mu1ARJy_7ScVxx9NKonUcTxiwyJtycpFk,15326
|
|
4
|
+
harlequin_sqlite_ssh/cli_options.py,sha256=pzPRMnbbo_NDV6D0e1setgpU_Nby_-VZqyGXz_Q3Zdo,3578
|
|
5
|
+
harlequin_sqlite_ssh/errors.py,sha256=eh1k9Rkj6j3xuMCyH4NP3Jrzk3OEtUYjKh3t1gnDKw0,2700
|
|
6
|
+
harlequin_sqlite_ssh/locations.py,sha256=xAslmXwAVo2aVtwPBU3m4tQ73PlOF7WPpakJxnNwwSg,8270
|
|
7
|
+
harlequin_sqlite_ssh/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
harlequin_sqlite_ssh/remote.py,sha256=SYRU1HNVo6P8DuWuS3a9iYs71zw6Mr4OVrBNSxWRoNY,13908
|
|
9
|
+
harlequin_sqlite_ssh/transport.py,sha256=DPKw5R9EVljhzYCRAsbtbMZ8ca2g3cuhKWTGw5NOPz0,26688
|
|
10
|
+
harlequin_sqlite_ssh-0.1.0.dist-info/METADATA,sha256=BWxfyCpQfwHNlPG_3_Yw_tHorRMZy7de_pE0vwJ162s,5830
|
|
11
|
+
harlequin_sqlite_ssh-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
12
|
+
harlequin_sqlite_ssh-0.1.0.dist-info/entry_points.txt,sha256=ebaycH6UUX7S2PleSmInfM7ndkuEkUq2R_tBRteGtnQ,80
|
|
13
|
+
harlequin_sqlite_ssh-0.1.0.dist-info/licenses/LICENSE,sha256=Q2c003GkR9PK3L3liC96nOdHqVInBKPAEv-L1Mo-80I,1063
|
|
14
|
+
harlequin_sqlite_ssh-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 lexo13
|
|
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.
|