Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
## [Unreleased]

### Added

- `ggsql repl`, an interactive session: SQL statements print as tables and,
with the `window` feature, queries with a `VISUALISE` clause draw in a
persistent native window that updates with each new plot. Statements end
with `;`; the reader stays open for the whole session, so tables created by
one statement are visible to the next.

### Changed

- The reader/dialect layer was refactored around a central dialect registry with
Expand Down
85 changes: 83 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,7 @@ panic = "abort"

[patch.crates-io]
sqlite-wasm-rs = { git = "https://github.com/ggsql-dev/sqlite-wasm-rs.git", branch = "loadable-extensions" }
# Temporary, for the REPL plot window: builds against the local hephaestus
# checkout carrying the cross-thread window message API (posit-dev/hephaestus#49).
# Remove once a hephaestus release containing it is published.
hephaestus = { path = "../hephaestus" }
18 changes: 18 additions & 0 deletions doc/get_started/tooling/cli.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,24 @@ Resizing the window re-lays-out the plot rather than stretching it, so labels an

Like the raster writers, the viewer renders through the GPU and is not in every build. The subcommand exists either way and says what would enable it.

## Interactive sessions

`ggsql repl` starts an interactive session in the terminal:

```bash
ggsql repl
```

Statements end with `;`. A plain SQL statement prints its table; a query with a `VISUALISE` clause draws its plot in a native window that opens when the session starts and updates in place with each new plot. The database connection stays open for the whole session, so a table created by one statement is visible to the next:

```
ggsql> CREATE TABLE penguins AS SELECT * FROM 'penguins.csv';
ggsql> SELECT species, COUNT(*) AS n FROM penguins GROUP BY species;
ggsql> SELECT * FROM penguins VISUALISE species AS fill DRAW bar;
```

History is kept across sessions, Ctrl-C abandons the statement being typed rather than the session, and `:quit` (or Ctrl-D) leaves — closing the window ends the session too. `:help` lists the commands. The session takes the same flags as `ggsql view`: `--reader` and `--cache` for the data source, and `-D` for the window's `width`, `height`, `background` and `title`. Like the viewer, the plot window renders through the GPU and is not in every build; the subcommand exists either way and says what would enable it.

## Documentation

The ggsql CLI has built-in documentation for ggsql syntax and usage. Run `ggsql docs` for an overview of available documentation topics, and `ggsql docs [topic]` to read about a specific topic.
Expand Down
1 change: 1 addition & 0 deletions ggsql-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ serde_json.workspace = true

# Regex (used by `docs` markdown post-processing)
regex.workspace = true
rustyline = "18.0.1"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
# Terminal markdown rendering for `ggsql docs` (native targets only;
Expand Down
Loading
Loading