News for hackers. Stuff that matters.
Re:SQL: 2023 is finished: Here is what's new by mikece on Thursday April 13, 2023 @08:07PM (#35563876)
Is there a competing query strategy, technology, or approach to compete with SQL? Yes, it gets the job done but it's always felt kludgy.
Re:SQL: 2023 is finished: Here is what's new by fbdab103 on Thursday April 13, 2023 @08:39PM (#35564134)
I really like what PRQL[0] is doing. Fixes a lot of the unfortunate SQL syntax. My impossible dream is that after years of language stability, Postgres could make it a first party query language.

[0] https://prql-lang.org/

Re:SQL: 2023 is finished: Here is what's new by LeonenTheDK on Thursday April 13, 2023 @08:56PM (#35564268)
Wow, this looks like it fixes a lot of the minor gripes I have with SQL, thanks for mentioning it. It feels way less cludgy and "modernized" compared to SQL.
Re:SQL: 2023 is finished: Here is what's new by iudqnolq on Thursday April 13, 2023 @09:03PM (#35564315)
That reminds me of the Ecto DSL.
Re:SQL: 2023 is finished: Here is what's new by TylerE on Thursday April 13, 2023 @09:32PM (#35564473)
Maybe as a baby step we could just get legal trailing commas
Re:SQL: 2023 is finished: Here is what's new by candiddevmike on Thursday April 13, 2023 @09:40PM (#35564525)
Or force the big RDBMS to use the same syntax like SQL was intended to be, so I don't have to reach for an ORM or maintain different flavors of the same query.

If someone knows a tool that reliably converts PostgreSQL queries to something like SQLite, please share!

Re:SQL: 2023 is finished: Here is what's new by TylerE on Thursday April 13, 2023 @10:15PM (#35564722)
Not sure how such a tool could possibly exist, given all the functionality of Postgres that SQLite simply lacks.
Re:SQL: 2023 is finished: Here is what's new by steve_gh on Friday April 14, 2023 @01:31AM (#35565845)
You could ask ChatGPT to do this sort of conversion
Re:SQL: 2023 is finished: Here is what's new by TylerE on Friday April 14, 2023 @01:36AM (#35565865)
Still not going to have wave around things like not having transactions or proper trigger functions.
Re:SQL: 2023 is finished: Here is what's new by hnlmorg on Friday April 14, 2023 @03:33AM (#35566577)
SQLite does have transactions. But I do agree with your general point that Sqlite is worlds apart from Postgre
Re:SQL: 2023 is finished: Here is what's new by alserio on Friday April 14, 2023 @02:03AM (#35566027)
haven't really tried for that transform but have a look at https://www.jooq.org/translate/
Re:SQL: 2023 is finished: Here is what's new by snthpy on Saturday April 15, 2023 @03:09AM (#35578343)
sqlglot might be what you are looking for.

https://github.com/tobymao/sqlglot

Re:SQL: 2023 is finished: Here is what's new by jiggawatts on Thursday April 13, 2023 @09:35PM (#35564494)
The syntax looks very similar to Microsoft's Kusto Query Language (KQL): https://learn.microsoft.com/en-us/azure/data-explorer/kusto/...

It's interesting to see that everyone's attempt at fixing SQL seems to converge on surprisingly similar solutions...

Re:SQL: 2023 is finished: Here is what's new by tehlike on Friday April 14, 2023 @12:19AM (#35565468)
Microsoft did linq first which is probably the basis for the rest.
Re:SQL: 2023 is finished: Here is what's new by fbdab103 on Friday April 14, 2023 @12:52AM (#35565646)
From first principles, it seems reasonable to expect transformations to go in a linear order. From there you look for ways to minimize special cases (eg why is `where` different from `having`?). Then you can just layer on some quality of life things which would appear to a designer after five minutes of real-world use (dear god, please let me have trailing commas).

I would expect there to be a lot of convergent evolution as how to go from a pile of data to narrowing on what you want.

Re:SQL: 2023 is finished: Here is what's new by giovannibonetti on Thursday April 13, 2023 @08:17PM (#35563973)
There are some ideas based on Datalog, like this one:

https://opensource.googleblog.com/2021/04/logica-organizing-...

Re:SQL: 2023 is finished: Here is what's new by resonantjacket5 on Thursday April 13, 2023 @08:20PM (#35563998)
I've read about edgedb in the past https://www.edgedb.com/blog/we-can-do-better-than-sql where they mainly changed the query language, underlying it still uses postgres. Though not sure how successful they've been.
Re:SQL: 2023 is finished: Here is what's new by nhumrich on Thursday April 13, 2023 @08:16PM (#35563962)
You mean, the ORM?

Edgedb also is nice if you want a more object like model for your db.

Re:SQL: 2023 is finished: Here is what's new by mind-blight on Thursday April 13, 2023 @09:28PM (#35564455)
ORMs generally solve a different problem than the query language. In SQL, everything is a table (that's not 100% true, but it's close enough). So, joins still result in a flat list of records.

ORMs solve the problem of translating a flat list of records into objects that have arrays of other objects. Some people also use them to avoid having to write SQL, but that's honestly a secondary feature.

You can have a more modern query language that still results in tables

Re:SQL: 2023 is finished: Here is what's new by abh123 on Thursday April 13, 2023 @09:36PM (#35564498)
Spark dataframes in Scala seem to combine the best parts of relational queries with at least some typing.

https://spark.apache.org/docs/1.6.1/api/java/org/apache/spar...

Re:SQL: 2023 is finished: Here is what's new by genuine_smiles on Thursday April 13, 2023 @09:44PM (#35564551)
KQL https://learn.microsoft.com/en-us/azure/data-explorer/kusto/...

Hers a simple example:

  StormEvents
  | where StartTime between (datetime(2007-11-01) .. datetime(2007-12-01))
  | where State == "FLORIDA"
  | count
Re:SQL: 2023 is finished: Here is what's new by thejosh on Thursday April 13, 2023 @10:38PM (#35564898)
I really like "modern SQL". Snowflake has some great functions and ideas, I really hope other databases take some of their ideas. It also has its pain points (ex Oracle.. so some notions they have about databases like NULLs is a bit meh).

Paired with dbt makes data quite fun

Re:SQL: 2023 is finished: Here is what's new by mamcx on Thursday April 13, 2023 @10:53PM (#35564996)
There are many, but most never go further than SQL (ie: Are just a "query" language).

I'm trying to do it for a "general purpose" language where array + relational + functional + imperative can work together:

https://tablam.org

---

One of the biggest damage that SQL has caused is that SQL is so bad as being a programming language, is not good enough DSL and is weirdly the only game in town, that many can't imagine that the relational model allows to do programming like every other model, just richer in "intrinsic" operators.

This is the deal with RDBMS. Is like: "Everyone implement a wild flavor of a VM, sometimes JVM, .NET VM, Web Assembly, eBPF, etc, but all use a slight variation of Java for their syntax"

Is like the reverse of how things are done!

Re:SQL: 2023 is finished: Here is what's new by carlineng on Friday April 14, 2023 @12:56AM (#35565665)
I've written quite a bit about a new query language called Malloy: https://carlineng.com/?postid=malloy-intro#blog

It's a semantic layer with an integrated query language that makes a ton of improvements on SQL. Full disclosure, I actually joined the team a couple of weeks ago :)

Re:SQL: 2023 is finished: Here is what's new by yayitswei on Friday April 14, 2023 @12:59AM (#35565679)
Datalag is great! I use it every day in production.

https://www.learndatalogtoday.org/

Re:SQL: 2023 is finished: Here is what's new by skc on Friday April 14, 2023 @01:37AM (#35565874)
An unfortunate typo.
Re:SQL: 2023 is finished: Here is what's new by Breza on Tuesday April 18, 2023 @02:33PM (#35617969)
R's dbplyr package lets you use the amazing dplyr syntax to query SQL databases.