Email or username:

Password:

Forgot your password?
Simon Willison

My notes on Google Research's new paper describing "pipe syntax", their alternative syntax for SQL queries which they've been rolling out internally since February simonwillison.net/2024/Aug/24/

For this SQL query:

SELECT component_id, COUNT(*)
FROM ticketing_system_table
WHERE
  assignee_user.email = 'username@email.com'
  AND status IN ('NEW', 'ASSIGNED', 'ACCEPTED')
GROUP BY component_id
ORDER BY component_id DESC;

The Pipe query alternative would look like this:

FROM ticketing_system_table
|> WHERE
    assignee_user.email = 'username@email.com'
    AND status IN ('NEW', 'ASSIGNED', 'ACCEPTED')
|> AGGREGATE COUNT(*)
   GROUP AND ORDER BY component_id DESC;
20 comments
Simon Willison

Google Research published the paper as a two-column PDF with no HTML equivalent, so as an experiment I uploaded that PDF to Google AI Studio and told gemini-1.5-pro-exp-0801 "Convert this document to neatly styled semantic HTML" - it did pretty well! static.simonwillison.net/stati

Simon Willison

... possibly too well, six hours after I published that it was already the third search result on Google for the title of the paper!

Since I hadn't reviewed the conversion for correctness I've now added a meta tag to de-index it from the search engine

Google search results for "SQL Has Problems. We Can Fix Them: Pipe Syntax In SQL"

First result is the official Google abstract page. Second is a LinkedIn post by Dave Herrald. Third is my HTML conversion of the paper, shown as "6 hours ago"
aos_

@simon I’ve recently started digging into Elixir and the library used for database abstraction called Ecto has this as a feature. It’s really nice: hexdocs.pm/ecto/Ecto.Query.htm

Leon Bambrick

@simon interesting!

I noticed that (on iOS Safari) I couldn’t use “dark night” plugin to turn it into dark mode. (Thought I could use reader mode to darken it).

Any idea if this is something you’ve explicitly blocked via a meta tag?

(My main reason for wanting to view the original as html was to aid legibility, particularly by having it in darkmode. My eyes are flaring up with photophobia and it’s literally agonising to read black on white at the moment.)

Leon Bambrick

@simon

“REFERENCES

(A long list of references, which I won't reproduce here to save space.)”

I know it’s mean to laugh at the poor AI that is doing the best it can… but there’s always space in html. 🙂

(Thank you for this conversion btw.)

Adriano

@simon Saw this pass by, and the combo
"It did pretty well!
[...]
Since I hadn't checked the conversion for correctness..."

is kinda the thing us LLM detractors like to latch on.

Simon Willison

@adriano sure, that’s why I specifically called it out - they’re not wrong about that kind of thing

Simon Willison

@adriano but if they chose not to consider how much time this would save in terms of doing the work to produce a verified, 100% correct HTML version of that PDF that’s on them at this point

Neil Kandalgaonkar

@simon Huh, I had wondered about exactly this as a service, but hadn’t made the connection with AI

Panning and scanning on mobile is terrible. And I am just a casual scientific paper reader

Owen Nelson

@simon we called this "pipe forward" in fluxlang docs.influxdata.com/flux/v0/ge

I forget the history to it, but I think it was borrowed from some other lang. Elixir maybe?

Drew Breunig

@simon This is like the 4th SQL alternative? At DuckCon last year, I swear half the presenters where flogging their own separate fix. Just bonkers.

Tim Schilling

@simon wait, it doesn't explicitly list the selected fields?

Simon Willison

@CodenameTim in that example I guess not? Maybe the fields are implied by the AGGREGATE clause

Pope Bob

@simon I don't immediately see the benefit of this, and I can only imagine this is a step in the EEE (Embrace, Extend, Extinguish) direction.

Sevoris

@simon Interesting with the whole Pipe syntax thing. I‘ve come to enjoy the power of relational operators for data modelling, but this is the reason I prefer things like PySpark or DuckDBs relational API - you can use builder patterns to do the same thing that happens here. (And it‘s not like this breaks the underlying operations tree. It‘ll be optimized anyway.)

Brian Reiter

@simon this looks a lot like Microsoft’s LINQ declarative query syntax.

lostprototype

@simon - This will be some hilarious prank on DBAs who have spent the last 2 decades irrationally railing against ORMs - Entity Framework in particular.

Under the hood, it's probably quite similar to LINQ and then an engine to translate the AST to SQL!

Bastian Venthur

@simon Came for the SQL, stayed for the rant about PDFs with two columns 😅

Go Up