Repository navigation
feat(viz): require ggsql >= 0.5.2 and update syntax prompt - #322
Merged
Merged
Conversation
cpsievert
added a commit
that referenced
this pull request
Oct 13, 2026
With viz execution routed through ggsql.CachingReader (this PR; R equivalent landing in the same release), DRAW ... MAPPING ... FROM <source> works end-to-end, so replace the note-3 layer_type workaround with the layer-level FROM pattern: an example plotting raw points from the final SELECT alongside a summary line from a CTE (verified end-to-end through ggsql.CachingReader 0.5.2). Also notes that FROM attaches to MAPPING — a bare 'DRAW line FROM t' is a parse error. Ported from #322 (9d87d74), where this prompt change landed ahead of the execution path that makes it true.
cpsievert
force-pushed
the
docs/ggsql-syntax-prompt-updates
branch
from
October 13, 2026 15:22
9d87d74 to
bd2dcec
Compare
cpsievert
force-pushed
the
docs/ggsql-syntax-prompt-updates
branch
4 times, most recently
from
October 13, 2026 15:43
46ac717 to
cd0a2d9
Compare
The shared ggsql-syntax.md system prompt predates ggsql 0.4.0: - The range layer's `width` setting was renamed to `hinge` (0.4.0); the old `SETTING width => null` now fails validation, so update the range bullet and lollipop example. - VISUALISE FROM now takes exactly one bare source (0.5.0); aliases, joins, and comma-separated tables are parse errors. - Note 3 rewritten: layer-level FROM sources work where querychat runs through a ggsql caching reader; the single-final-relation pattern stays as the portable recommendation. - Document new features: `aggregate` setting on identity-stat layers, jitter position, boxplot hinge/side settings, categorical-aesthetic omission for boxplot/violin/range, polar radar setting, rich-text label parsing (+ `parse => false`), and `minor_breaks`. All claims verified by executing the queries against ggsql 0.5.2.
The system prompt now documents ggsql 0.5.x-only syntax (hinge, aggregate, jitter, radar, rich-text labels, minor_breaks), so running the visualize tool against an older ggsql would fail at query-validation time. - pyproject.toml: viz and dev extras require ggsql>=0.5.2 (was >=0.3.2) - R DESCRIPTION: ggsql (>= 0.5.2) in Suggests - Runtime guards (Python has_viz_deps(), R check_viz_deps()) treat ggsql < 0.5.2 like a missing install: warn once and drop the visualize tool, with messages stating the 0.5.2 requirement
cpsievert
force-pushed
the
docs/ggsql-syntax-prompt-updates
branch
from
October 13, 2026 15:46
cd0a2d9 to
30139c4
Compare
cpsievert
marked this pull request as ready for review
October 13, 2026 15:53
The Vega-Lite writer has no caption equivalent and silently drops it (unlike the native SVG/PDF writers), so stop advertising caption in the LABEL section and call it out in the Vega-Lite rendering section instead. Direct source attributions to subtitle, which does render.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related changes:
visualizetool only runs against a ggsql version that supports everything the system prompt documents (rather than failing at query-validation time).ggsql-syntax.mdsystem-prompt reference (identical copies inpkg-r/inst/prompts/andpkg-py/src/querychat/prompts/) to match current ggsql syntax.Version requirement
pyproject.toml:vizanddevextras now requireggsql>=0.5.2. (feat(pkg-py): route ggsql viz execution through ggsql.CachingReader #321 makes the same pyproject change for its own reasons — whichever lands second rebases over a trivial conflict there.)DESCRIPTION:ggsql (>= 0.5.2)inSuggests.has_viz_deps()and Rcheck_viz_deps()now treat unsupported ggsql versions the same as a missing installation — warn once and continue without thevisualizetool — with messages stating the 0.5.2 requirement.Prompt fixes for stale/breaking content
rangelayer'swidthsetting is nowhinge— the oldSETTING width => null(lollipop example,rangebullet) fails validation.VISUALISE FROMtakes exactly one bare source — aliases, joins, and comma-separated tables are parse errors; added an explicit warning.New features documented:
aggregatesetting on identity-stat layers;position => 'jitter';boxplothinge/sidesettings;boxplot/violin/rangemay omit the categorical aesthetic; polarradarsetting.Rendering context: a standalone "Vega-Lite rendering" section at the end of the reference collects every writer-dependent caveat in one place — querychat draws all charts through ggsql's Vega-Lite writer (not the native SVG/PDF writers), label text renders literally (so avoid markdown), and the
minor_breaksscale setting is ignored. If querychat's writer ever changes, that section is the single place to update.Deliberately not documented:
DRAW spatialand map projections, which require a spatial backend querychat execution contexts generally don't (yet) have.Out of scope: prompt wording around layer-level
FROMsources (DRAW ... MAPPING ... FROM <table>). That restriction is removed by #321, which carries the companion prompt change documenting them as supported — so this PR leaves note 3 untouched rather than restating a rule that's about to disappear.Verification
Every new/changed prompt claim was verified by executing the corresponding query against ggsql 0.5.2, including negative checks:
SETTING width => nullonrangeerrors andVISUALISE FROM tbl AS tis a parse error. Python prompt tests pass (test_viz_tools.py,test_base.py); the R-side prompt change is the identical markdown file, covered by CI. The existing R test forcheck_viz_deps()mocksrlang::is_installed(), so it covers the new version check unchanged;ruff check, pyright, andair formatare clean on the touched files.