April 20, 2026
Chart wars: SQL edition
ggsql: A Grammar of Graphics for SQL
SQL gets artsy: fans cheer while skeptics ask if it runs in the DB
TLDR: Posit’s ggsql lets you build charts with SQL-like commands, layering visuals like Lego for quick, flexible plots. The crowd loves the simplicity, but a debate rages over whether it runs inside databases or is just a SQL-flavored scripting tool—either way, it could speed up data storytelling.
Posit just dropped ggsql, a way to make charts using SQL-style commands like VISUALIZE and DRAW, and the comment section went full popcorn mode. Early hype rolled in fast: “Wow, love this idea,” gushed one fan, while others cheered the familiar “grammar of graphics” vibe—think building plots in layers like Lego. One commenter said it “brings plotting to SQL”, and folks were delighted by the idea of speaking chart instructions out loud. Also cameo of the year: the beloved penguins dataset, now starring in scatterplots.
But the spicy question that split the room: is this real SQL, or SQL cosplay? A sharp-eyed skeptic asked whether ggsql runs inside a database or is a “SQL-like” scripting language that renders charts in your notebook or editor. The docs seem to back that up—more DSL than database magic (get started). Meanwhile, practitioners loved the layering—add points, add a smooth trend line, swap, repeat—because it finally makes complex charts feel manageable. The vibe: enthused builders vs. definition sticklers, with a sprinkle of memes about “charting in plain English.” Where everyone agrees: this could make turning queries into pictures way less painful, whether you’re in Quarto, Jupyter, Positron, or VS Code.
Key Points
- •ggsql is an alpha-release implementing the Grammar of Graphics with SQL-like syntax.
- •It supports environments including Quarto, Jupyter notebooks, Positron, and VS Code.
- •Visualizations are defined with a VISUALIZE clause and built with layered DRAW statements that share mappings.
- •Examples show evolving a scatterplot with color and smooth regression layers, illustrating modularity.
- •A full example uses SQL (CTE, UNION ALL) to create a histogram with annotations, scales, and labels via ggsql clauses.