News for hackers. Stuff that matters.
Re:I don't want to learn your query language (2018) by pwinnski on Wednesday March 10, 2021 @09:46AM (#26411726)
> SQL makes it easy to write and read simple queries, and ridiculously complicated and arcane to write slightly more complex logic.

This is the thing that makes ORMs sound appealing: let's make the complicated things simple! In my experience, the complicated things are truly-complicated, not just because SQL makes them seem to be. So by the time you make Use Case A "simple," you've run into Use Case B and Use Case C, and by the time your ORM handles all of those, well, there's a good chance it still doesn't handle all of them, and however many it does handle, the syntax ends up being... complicated.

There is so much to be said for a known and well-supported standard, and we are so quick to assume we can do better. Most of them, we really can't.

But hey, keep trying! Coming up on 50 years, we should manage to surpass SQL at some point, right? And in the meantime, we'll have our five-thousandth ORM or DSL to reach the limits of and have to revert to SQL anyway for just those last two or three queries.

Re:I don't want to learn your query language (2018) by jredwards on Wednesday March 10, 2021 @12:02PM (#26413433)
I just can't get behind a sentiment that amounts to, "Hey guys, stop trying to innovate."
Re:I don't want to learn your query language (2018) by datavirtue on Wednesday March 10, 2021 @05:13PM (#26417088)
I can. The churn causes a lot of wheel reinvention, bugs out the ass, security vulnerabilities, dependency hell, and I know others here could go on a rant about something I'm completely missing.

We shouldn't stop innovating but we should sure as hell should stop chucking half baked shit into production.

One measly example: Cypress. Everyone raves about it in blog posts, some dev immediately downloads it into their project and does a POC and calls it good. Fast forward to mid-late project and you are upgrading, downgrading, refactoring, and spending hours and hours trying to work around the issues. It's a great innovation, but my god. Self-induced stress.

Re:I don't want to learn your query language (2018) by pwinnski on Wednesday March 10, 2021 @01:53PM (#26414658)
I literally said to keep trying!

47 years on, most experienced developers seem to agree that SQL is better extended than replaced, but innovations like graph databases and "NoSQL" document stores have been received very well.

Re:I don't want to learn your query language (2018) by workingworkguy on Wednesday March 10, 2021 @10:10AM (#26411996)
I'm one of the analysts causing issues for the OP, but a common example to me of something that's cake in a "real" language and frustrating in sql (ms in my case) is expanding a function to take a dynamic amount of params.

myFun param =

    for each param do...
Something like that has given me WAY more headaches than i ever expected, and that's before i saw vendor code (for systems that are used by millions) handling business logic in the stored proc with a 70 case switch statement...
Re:I don't want to learn your query language (2018) by hobs on Wednesday March 10, 2021 @10:35AM (#26412301)
That's what adhoc/dynamic SQL is for if you must, and power it with another language - you are trying to loops in a set based language, its the opposite of what its good at.
Re:I don't want to learn your query language (2018) by megagator on Wednesday March 10, 2021 @10:21AM (#26412134)
Databases are generally better at storing data, not logic.
Re:I don't want to learn your query language (2018) by pwinnski on Wednesday March 10, 2021 @10:57AM (#26412549)
That sounds like switch abuse, but a better-written query builder seems like a good solution here. Use `for each param` to build a SQL query, and you're golden.
Re:I don't want to learn your query language (2018) by eitland on Wednesday March 10, 2021 @03:19PM (#26415639)
> So by the time you make Use Case A "simple," you've run into Use Case B and Use Case C, and by the time your ORM handles all of those, well, there's a good chance it still doesn't handle all of them, and however many it does handle, the syntax ends up being... complicated.

Or you can do it the smart way:

Save an awful lot of time and hassle by using an ORM for all the boring stuff and have a couple of plain SQL queries for when you need it.

> And in the meantime, we'll have our five-thousandth ORM or DSL to reach the limits of and have to revert to SQL anyway for just those last two or three queries.

Or you can do it the smart way as I mentioned above and also just continue to use JPA.

Re:I don't want to learn your query language (2018) by carlps on Wednesday March 10, 2021 @10:47AM (#26412438)
I don't think anyone is going to argue with making complicated things simple. But from my experience, if it's complicated in SQL it's going to be a nightmare in the ORM. Generally, complicated SQL means that the underlying data was not modeled to solve the use case. Exactly as you mentioned, trying to simplify things in the ORM layer will be on a use case by use case level.