ggsql
  • Get started
  • Syntax
    • Overview

    • VISUALISE
    • DRAW
    • PLACE
    • SCALE
    • FACET
    • PROJECT
    • LABEL
  • Gallery
  • FAQ
  • Playground
  • Source Code
  • Report a Bug

ggsql is still in early development and all functionality are subject to change

QUERY VISUALIZE UNDERSTAND

ggsql brings the elegance of the Grammar of Graphics to SQL. Write familiar queries, add visualization clauses, and see your data transform into beautiful, composable charts — no context switching, no separate tools, just SQL with superpowers.

Get started View examples

Try it out

-- Regular query
SELECT * FROM ggsql:penguins
WHERE island = 'Biscoe'
-- Followed by visualization declaration
VISUALISE bill_len AS x, bill_dep AS y, body_mass AS fill
DRAW point
DRAW linear 
    MAPPING 0.4 AS coef, -1 AS intercept
SCALE BINNED fill
LABEL
   title => 'Relationship between bill dimensions in 3 species of penguins',
   x => 'Bill length (mm)',
   y => 'Bill depth (mm)'

Explore the examples

Scatter plot

Line chart

Bar chart

Histogram

Multi-layer plot

Faceted plot
No matching items

See all examples →

Install it today

Other platforms

or

# Jupyter kernel
uv tool install ggsql-jupyter
ggsql-jupyter --install

# CLI
uv tool install ggsql

Features

Familiar syntax

Write standard SQL queries and seamlessly extend them with visualization clauses. Your existing SQL knowledge transfers directly.

SELECT date, revenue, region
FROM sales
WHERE year = 2024
VISUALISE date AS x, revenue AS y
DRAW line

Grammar of graphics

Compose visualizations from independent layers, scales, and coordinates. Mix and match components for powerful custom visuals. The grammar of graphics provides you with a single mental model for every type of plot.

VISUALISE date AS x FROM sales
DRAW bar 
SCALE BINNED x 
    SETTING breaks => 'weeks'
FACET region

Built for humans and AI

The structured syntax makes it easy for AI agents to write, and for you to read, adjust, and verify.

You also avoid needing agents to launch full programming languages like Python or R to create powerful visualizations, so you can rest assured that the agent doesn’t accidentally alter your environment in unwanted ways.

Connect directly to your data

ggsql interfaces directly with your database. Want to create a histogram over 1 billion observations? No problem! All calculations are pushed to the database so you only extract what is needed for the visual.

Available where your data is

Positron

Quarto

Jupyter

VS Code

Ready to get started?

Install ggsql and start creating visualizations in minutes.

Installation Documentation Examples

Or try our online playground to experience the syntax right now.