ok, this is definitely up my alley. color me nerd-sniped and forgive the onslaught of questions. my questions are less about the syntax, which i'm largely familiar with knowing both SQL and ggplot. i'm more interested in the backend architecture. Looking at the Cargo.toml [1], I was surprised to not see a visualization dependency like D3 or Vega. Is this intentional? I'm certainly going to take this for a spin and I…
Let me try to not miss any of the questions :-) ggsql is modular by design. It consists of various reader modules that takes care of connecting with different data backends (currently we have a DuckDB, an SQLite, and an ODBC reader), a central plot module, and various writer modules that take care of the rendering (currently only Vegalite but I plan to write my own renderer from scratch). As for deployment I can only…
ggsql: A Grammar of Graphics for SQL
41–50 of 91 posts
Re: ggsql: A Grammar of Graphics for SQL
#42This is neat. I do wish there was a way for this to gracefully degrade in contexts without support for the grammar, though. I devised a similar in spirit (inside SQL, very simplified vs GoG) approach that does degrade (but doesn't read as nice): https://sqlnb.com/spec
Re: ggsql: A Grammar of Graphics for SQL
#43The cli only produces vega-lite[0] json graphics, right? It would be nice if it included a rendering engine. [0]: https://github.com/vega/vega-lite
Re: ggsql: A Grammar of Graphics for SQL
#44Earlier quoted context omitted.
Yes this was my question as well, an example showing all the plumbing/dependencies to generate a graph from an external database server would be very helpful.
We certainly plan to create a few videos showing how to set it up and use it. If you use it in Positron with the ggsql extension it can interact directly with the connection pane to connect to the various backends you have there
I eventually found this readme https://github.com/posit-dev/ggsql/tree/main/ggsql-python which tells me far more than anything I found on the website
Re: ggsql: A Grammar of Graphics for SQL
#45This is neat. I do wish there was a way for this to gracefully degrade in contexts without support for the grammar, though. I devised a similar in spirit (inside SQL, very simplified vs GoG) approach that does degrade (but doesn't read as nice): https://sqlnb.com/spec
I'm not quite sure I understand what you mean by "degrade in context" - care to elaborate?
# %%
foo = 1
# %%
print(foo)
Above is notebook with two "cells" & also a valid Python script. Perhaps it matters less with SQL vs Python, but it's a nice property.
Re: ggsql: A Grammar of Graphics for SQL
#46Earlier quoted context omitted.
Let me try to not miss any of the questions :-) ggsql is modular by design. It consists of various reader modules that takes care of connecting with different data backends (currently we have a DuckDB, an SQLite, and an ODBC reader), a central plot module, and various writer modules that take care of the rendering (currently only Vegalite but I plan to write my own renderer from scratch). As for deployment I can only…
Intermediate Representation
Re: ggsql: A Grammar of Graphics for SQL
#47Earlier quoted context omitted.
I'm not quite sure I understand what you mean by "degrade in context" - care to elaborate?
If you're familiar with the percent format for jupyter notebooks, something like that— so things gracefully degrade in a more "basic" execution context. # %% foo = 1 # %% print(foo) Above is notebook with two "cells" & also a valid Python script. Perhaps it matters less with SQL vs Python, but it's a nice property.
Re: ggsql: A Grammar of Graphics for SQL
#48Maybe I skim read it too fast, but I did not find any clear description in the blog post or website docs of how this relates to SQL databases I was kind of guessing that it doesn't run in a database, that it's a SQL-like syntax for a visualisation DSL handled by front end chart library. That appears to be what is described in https://ggsql.org/get_started/anatomy.html But then https://ggsql.org/faq.html has a section…
> SQL databases ... confused "SQL" and "databases" are different things SQL is a declarative language for data manipulation. You can use SQL to query a database, but there's nothing special about databases. You can also write SQL to query other non-database sources like flat files, data streams, or data in a program's memory. Conversely, you can query a database without SQL.
fond memories of quel.
Re: ggsql: A Grammar of Graphics for SQL
#49Maybe I skim read it too fast, but I did not find any clear description in the blog post or website docs of how this relates to SQL databases I was kind of guessing that it doesn't run in a database, that it's a SQL-like syntax for a visualisation DSL handled by front end chart library. That appears to be what is described in https://ggsql.org/get_started/anatomy.html But then https://ggsql.org/faq.html has a section…
ggsql has the concept of a "reader", which can be thought of as the way ggsql interfaces with a SQL database. It handles the connection to the database and generating the correct dialect of SQL for that database. As an alpha, we support just a few readers today: duckdb, sqlite, and an experimental ODBC reader. We have largely been focusing development mainly around driving duckdb with local files, though duckdb has e…
Re: ggsql: A Grammar of Graphics for SQL
#50I skimmed the article for an explanation of why this is needed, what problem it solves, and didn't find one I could follow. Is the point that we want to be able to ask for visualizations directly against tables in remote SQL databases, instead of having to first pull the data into R data frames so we can run ggplot on it? But why create a new SQL-like language? We already have a package, dbplyr, that translates betwe…
What makes it interesting is the interface (SQL) coupled with the formalism (GoG). The actual visualization or runtime is an implementation detail (albeit an important one).