HeadlinesBriefing favicon HeadlinesBriefing.com

ggsql Lets SQL‑Lovers Build Graphics Like Code

Hacker News •
×

ggsql, a new SQL‑based grammar of graphics engine, drops its alpha today and plugs directly into tools like Quarto, Jupyter, Positron and VS Code. Developers can now write visualizations in plain SQL syntax, turning data queries into plots without leaving the database layer.

The engine follows the classic *Grammar of Graphics* model: a VISUALIZE clause declares mappings, and subsequent DRAW, PLACE, SCALE and LABEL clauses add layers, annotations, color scales and titles. A scatterplot of the built‑in penguins data shows how adding a color mapping or a smooth regression layer expands the visual step by step, while a histogram of astronaut ages demonstrates more advanced layers and annotations.

ggsql’s design lets the SQL portion feed directly into the visual query, so any CTE or temporary table created before VISUALIZE can be reused in the plot. The syntax remains close to standard SQL, easing adoption for analysts who already write queries in DuckDB or similar engines.

With its modular layering and tight integration into popular notebooks, ggsql offers a practical shortcut for analysts who want reproducible, code‑driven visualizations without learning a separate plotting library.