Live data from Hacker News

Google's new pipe syntax in SQL

simonwillison.net

11–20 of 192 posts

Re: Google's new pipe syntax in SQL

#11

Richard Hipp, creator of SQLite, has implemented this in an experimental branch: https://sqlite.org/forum/forumpost/5f218012b6e1a9db Worth reading the thread, there are some good insights. It looks like he will be waiting on Postgres to take the initiative on implementing this before it makes it into a release.

FROM first would be nothing short of incredible. I can only hope that Postgres and others can find it within themselves to get together and standardize on such an extension!

Re: Google's new pipe syntax in SQL

#12
This reminds me .NET's short lived Linq to SQL;

There was a talk at the time, but I can't find the video: http://jaoo.dk/aarhus2007/presentation/Using+LINQ+to+SQL+to+....

Basically, it was a way to cleanly plug SQL queries into C# code.

It used this sort of ordering (where the constraints come after the thing being constrained); it needed to do so for IntelliSense to work.

Re: Google's new pipe syntax in SQL

#13

Richard Hipp, creator of SQLite, has implemented this in an experimental branch: https://sqlite.org/forum/forumpost/5f218012b6e1a9db Worth reading the thread, there are some good insights. It looks like he will be waiting on Postgres to take the initiative on implementing this before it makes it into a release.

That comment where he explains why he's not rushing to add new unproven SQL syntax to SQLite is fascinating:

> My goal is to keep SQLite relevant and viable through the year 2050. That's a long time from now. If I knew that standard SQL was not going to change any between now and then, I'd go ahead and make non-standard extensions that allowed for FROM-clause-first queries, as that seems like a useful extension. The problem is that standard SQL will not remain static. Probably some future version of "standard SQL" will support some kind of FROM-clause-first query format. I need to ensure that whatever SQLite supports will be compatible with the standard, whenever it drops. And the only way to do that is to support nothing until after the standard appears.

Re: Google's new pipe syntax in SQL

#14
post #12

This reminds me .NET's short lived Linq to SQL; There was a talk at the time, but I can't find the video: http://jaoo.dk/aarhus2007/presentation/Using+LINQ+to+SQL+to+... . Basically, it was a way to cleanly plug SQL queries into C# code. It used this sort of ordering (where the constraints come after the thing being constrained); it needed to do so for IntelliSense to work.

> This reminds me .NET's short lived Linq to SQL;

"Short lived"? Its still alive, AFAIK, and the more popular newer thing for the same use case, Linq to Enntities, has the same salient features but (because it is tied to Entity Framework and not SQL Server specific) is more broadly usable.

Re: Google's new pipe syntax in SQL

#16
post #15

LINQ, PRQL, Kusto has all preceeded this. While LINQ is mostly restricted to .NET, PRQL is not. https://prql-lang.org/ It's a welcome change in the industry. I made this prediction a couple years back: https://x.com/tehlike/status/1517533067497201666

I’m a big kusto user, and it’s wonderful to have pipes in a query language.

If you haven’t tried it, it’s great!

Re: Google's new pipe syntax in SQL

#17

Previous submissions on the paper itself: https://news.ycombinator.com/item?id=41321876 (first) https://news.ycombinator.com/item?id=41338877 (plenty of discussions) I tried this new syntax and this seems a reasonable proposal for complex analytical queries. This new syntax probably does not change most simple transactional queries though. The syntax matches the execution semantic more closely, which means you less l…

Kinda looks like a half-assed version of what PRQL does. Like, if we’re going to have nonstandard sql, let’s just fix a whole bunch of things, not just one or two?

Re: Google's new pipe syntax in SQL

#18
post #15

LINQ, PRQL, Kusto has all preceeded this. While LINQ is mostly restricted to .NET, PRQL is not. https://prql-lang.org/ It's a welcome change in the industry. I made this prediction a couple years back: https://x.com/tehlike/status/1517533067497201666

I’m a big kusto user, and it’s wonderful to have pipes in a query language. If you haven’t tried it, it’s great!

I have not tried it, but I used to be a .net developer and worked a lot with LINQ (and contributed a bit to NHibernate and its Linq provider) and I am a big fan of the approach.

Kusto does seem interesting too, and i think some of the stuff i want to build will find a use for it!

Re: Google's new pipe syntax in SQL

#19
Is there research on what is easier to read when you are sifting through many queries?

I like the syntax for reading what the statement expects to output first, even though I agree that I don’t write them select first. I feel like this might be optimizing the wrong thing.

Although the example is nice, it does not show 20 tables joined first, which will really muddle it.

Re: Google's new pipe syntax in SQL

#20
post #12

This reminds me .NET's short lived Linq to SQL; There was a talk at the time, but I can't find the video: http://jaoo.dk/aarhus2007/presentation/Using+LINQ+to+SQL+to+... . Basically, it was a way to cleanly plug SQL queries into C# code. It used this sort of ordering (where the constraints come after the thing being constrained); it needed to do so for IntelliSense to work.

"Short-lived"? LINQ is very much alive in the C# ecosystem.

And FROM-first syntax absolutely makes more sense, regardless of autocomplete. You should put the "what I need to select" after the "what I'm selecting from", in general.

Post reply on HN