I find there's two things which Object-Relational Mappers like Django's provides. One infrequently useful one is relatively constructing queries from user input.

The other is versioning of your database schema, allowing you to easily upgrade and downgrade your databases. Not all ORMs provide this, but handcoding that logic I miss it.

Also I hear many developers don't like SQL's syntax, but I think that's a mix of it being overpowered for them and them haven't really had tried it.

@alcinnz Raises hand: used SQL all my life, possibly more than 20 years, I don't even remember. I hate it. It's a remnant from a long gone era that only makes sense for a few use cases. All useful data is linked, it makes no sense to link it at query time every time you run a query. I think multi-model keystore-document-graph databases like OrientDb and Arango (which provide a SQL-like interface on top) are a good compromise. Personally I prefer no SQL at all these days.

@haitch I can agree that whether you use SQL should be dependent on what data you have and how you want to use it.

If you're just using it to look things up by ID, SQL is more powerful then you need and you'd benefit from something simpler.

And if your data is "open world" (incorporates arbitrary external data) you'd benefit from using a language like SPARQL instead. Though not enough sites currently have this property.

But I like SQL for what it's good at.

@alcinnz 1) Is the schema mutable?
2) Does the data really represent documents, possibly with nested elements?
3) Is the data linked, with possibly several many to many relayionships?
4) Do you often find yourself writing LEFT OUTER JOIN?
5) Does the data have a graph-like structure and you sometimes nedd to find shortedt paths between data?

If any of these things is true, then SQL is not the best tool for the job. Nowadays, it almost never is unless there's legacy code involved.

@haitch I'm not sure that I agree on how rarely SQL is suited to your task, but I don't care enough to argue it further.

All I'm saying is don't discount SQL for your project because it's old. Discount it because you're not really processing your data, or because you need to deal with plenty of external data you don't want to or can't injest.

@alcinnz I should have clarified that 'I use SQL because it's useful, familiar, and less costly to me to use what I already know' is a perfectly valid reason. I don't reject SQL because it's old, but because there are objectively superior tools for most of the use cases where we just used SQL without much thought in the past because there really weren't many comparably powerful options available. And that's factually just not the case anymore.

Follow

@haitch Yes, too often we use tools because it's "in our stack" rather than thinking critically about whether it's appropriate.

But also there's the aspect that it's well suited to silos, which are things I wish didn't exist.

Sign in to participate in the conversation
FLOSS.social

For people who care about, support, or build Free, Libre, and Open Source Software (FLOSS).