3 ms·
Like some siblings mention, this is the object-relational impedance mismatch. A decent ORM like SQLAlchemy goes some way to closing this gap. Less good ORMs lik
by globular-toast 2y ago
Like some siblings mention, this is the object-relational impedance mismatch. A decent ORM like SQLAlchemy goes some way to closing this gap. Less good ORMs like Django don't help much at all, though.
When you talk about "just" using nested data in your database you seem to be forgetting a whole load of problems that relational databases solve like concurrency issues, write performance, data integrity and consistency etc. The book Designing Data-Intensive Applications by Kleppmann is an essential read.
- boxed 2y agoHeh. I was just going to comment on how Djangos ORM is great because it cleanly and transparently solves the number one problem of the paper: the horrible joins. SQLAlchemy however falls flat on its face in this regard.
- globular-toast 2y agoDjango makes querying easier by generating the code for the joins, but you're still joining tables. The point about SQLAlchemy was specifically about the issue mentioned by the GP, namely having to make more tables for composites. SQLAlchemy does a better job of mapping db tables back to regular objects. With Django you get the `alias_set` stuff but it never lets you forget that this is really a database table. Django uses the active record pattern while SQLAlchemy is a data mapper.