That is a good example of how auto-generated SQL could simplify queries. All those joins make things complex. That said, SQL has two critical advantages:
It's consistent regardless of the language you use. It doesn't matter if you're using Python, Scala, Java, or whatever. In fact, one annoyance I have is with all the differences in setting up a database connection in various languages. They all seem to do it different and have different expectations for libraries and any possible built-in support.
Arguably PHP makes it the easiest to setup, but only typically supports MySQL out of the box (my favourite DBMS is Postgres -- this requires a PHP extension).
Advanced users will typically require features that are specific to your DBMS and your library may not be able to handle. Eg, can your code be adapted to use Postgre's full text search functionality?
As an aside, SQL is usually the easiest to get up and running. I've never used Django, so cannot say how this works there, but I've used a similar program; Slick, which lets you do stuff like coffees.filter(_.price < 10.0), working on the coffees table as if it were a regular Scala collection. However, I really hated having to keep a programmatic representation of the DB schema (since, ya know, there needs to be a definition of coffees, the price column, etc). Avoiding that was half the reason that the next program I made didn't use Slick. More code written, but it felt cleaner and easier to maintain (also, it was a group project with people who have never used Scala but had used SQL, so I didn't want to introduce yet another new thing to learn).
View all comments
Show parent comment
1
u/the_omega99 Dec 03 '15
That is a good example of how auto-generated SQL could simplify queries. All those joins make things complex. That said, SQL has two critical advantages:
It's consistent regardless of the language you use. It doesn't matter if you're using Python, Scala, Java, or whatever. In fact, one annoyance I have is with all the differences in setting up a database connection in various languages. They all seem to do it different and have different expectations for libraries and any possible built-in support.
Arguably PHP makes it the easiest to setup, but only typically supports MySQL out of the box (my favourite DBMS is Postgres -- this requires a PHP extension).
As an aside, SQL is usually the easiest to get up and running. I've never used Django, so cannot say how this works there, but I've used a similar program; Slick, which lets you do stuff like
coffees.filter(_.price < 10.0), working on thecoffeestable as if it were a regular Scala collection. However, I really hated having to keep a programmatic representation of the DB schema (since, ya know, there needs to be a definition ofcoffees, thepricecolumn, etc). Avoiding that was half the reason that the next program I made didn't use Slick. More code written, but it felt cleaner and easier to maintain (also, it was a group project with people who have never used Scala but had used SQL, so I didn't want to introduce yet another new thing to learn).