ggsql

Solid

Write ggsql queries — a grammar of graphics for SQL. Use when the user wants to create, modify, or understand a ggsql visualization query.

API & Backend 396 stars 34 forks Updated today MIT

Install

View on GitHub

Quality Score: 94/100

Stars 20%
87
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# ggsql Query Writer ggsql is a SQL extension for declarative data visualization based on Grammar of Graphics principles. It lets users combine SQL data queries with visualization specifications in a single, composable syntax. When the user describes a visualization they want, write a valid ggsql query. Use ONLY syntax documented below. NEVER invent clauses, settings, aesthetics, or layer types. ## Query structure A ggsql query has two parts: 1. **SQL part** (optional): Standard SQL executed on the backend. Any tables, CTEs, or SELECT results are available to the visualization. 2. **VISUALISE part** (required): Begins with `VISUALISE` (or `VISUALIZE`). Everything after this is the visualization query. There are two patterns for combining SQL with VISUALISE: ### Pattern A: SELECT → VISUALISE The last SQL statement is a SELECT. Data flows from its result set into VISUALISE, which has no `FROM` clause. ```ggsql SELECT name, score_a, score_b FROM 'dataset.csv' WHERE value > 50 VISUALISE score_a AS x, score_b AS y [DRAW / PLACE / SCALE / FACET / PROJECT / LABEL clauses] ``` Works with any SQL that ends in a SELECT: bare SELECT, WITH...SELECT, UNION/INTERSECT/EXCEPT. ### Pattern B: VISUALISE FROM VISUALISE provides its own data source via `FROM`. Use when referencing a table, file, CTE, or built-in dataset directly without a trailing SELECT. ```ggsql VISUALISE score_a AS x, score_b AS y FROM 'dataset.csv' DRAW point ``` ```ggsql WITH summary AS (SELECT category, COUNT...

Details

Author
posit-dev
Repository
posit-dev/skills
Created
6 months ago
Last Updated
today
Language
R
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category