Metadata-Version: 2.4
Name: jusi-clickhouse
Version: 0.2.1
Summary: ClickHouse exact-provider plugin for Jusi 1.0 SQL
Author: Jusi contributors
License: MIT License
        
        Copyright (c) 2026 notawhaleble
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Requires-Python: >=3.9
Requires-Dist: clickhouse-connect>=0.7
Requires-Dist: jusi-sql<0.3,>=0.2
Requires-Dist: jusi<2,>=1.0.2
Requires-Dist: visidata<4,>=3
Provides-Extra: test
Requires-Dist: pytest<9,>=8; extra == 'test'
Description-Content-Type: text/markdown

# jusi-clickhouse

`jusi-clickhouse` is the ClickHouse exact-provider plugin for Jusi 1.0 and the
shared `jusi-sql` family. It exposes the `clickhouse` provider for `%%sql`
cells. The family owns target selection, magic dispatch, completion ranges,
metadata caching, operation routing, and common VisiData SQL commands.

Configure a SQL target in the Jusi session config:

```toml
[sql.targets.analytics]
provider = "clickhouse"
host = "localhost"
port = 8123
username = "default"
password = ""
database = "default"
initial_fetch = 100
```

Use it from a cell:

```sql
%%sql analytics
SELECT *
FROM system.numbers
LIMIT 1000
```

Results open in VisiData. Press `1`-`9` to fetch more rows, `gf` to prompt for a fetch count (`0` fetches the rest), and `gb` to open the selected raw value through VisiData. `gc` and `gr` are present for SQL-family parity, but ClickHouse transaction control is reported as unsupported.

Follow-up cells reuse the same VisiData application, ClickHouse connection, and
open result streams. `JusiInterrupt` requests cancellation of active queries.
Closing the client closes its streams, connection, private control socket, and
staged launch data.

The terminal application loads normal VisiData user configuration and plugins
before installing Jusi and ClickHouse commands. This includes `~/.visidatarc`
and paths selected through `VD_CONFIG` and `VD_DIR`.

For a local manual-test database:

```bash
./scripts/run-clickhouse.sh
```

The script builds `jusi-clickhouse-dev`, starts a local ClickHouse container, loads demo tables under `demo`, waits until it is ready, and prints a matching `jusi.toml` block.
