Hacker News new | ask | show | jobs
by normaljoe 3103 days ago
Django's ORM is actually a good example of where identity is an issue. It lacks composite primary keys. If I have a dependent table that has my real ID, say an order number that is a varchar I have to join to the parent table to do lookups by the order number. I can't doing something like key(order_number, line_number) so I end up hydrating a parent object for operations that only require operations on the dependent objects.
2 comments

It doesn't have to hydrate the parent object, just use .only('relation_id').
an ORM does not have to solve every single problem you have, write your raw sql and run it.