4 ms·
Model validation should have been there from day one. Well thats what us Domain-Driven-Design advocates push. SQLAlchemy is way more powerful and flexible. S
by smithjchris 17y ago
Model validation should have been there from day one. Well thats what us Domain-Driven-Design advocates push.
SQLAlchemy is way more powerful and flexible. Scan the SQLAlchemy documentation for examples. Particularly storing nested structures and support for inheritance (which is broken in Django).
SQLAlchemy is basically Hibernate in Python.
- ubernostrum 17y agosupport for inheritance (which is broken in Django) Django's ORM supports: * Multi-table inheritance (just subclass and do stuff). * Abstract parent classes (which get you most use cases for single-table inheritance). * Pure-Python inheritance (via proxy models). So I'm not sure how that's "broken". But it's also worth noting that Django's ORM and SQLAlchemy approach the problem of ORM from opposite directions: Django starts at the object layer and works back to SQL, while SQLAlchemy starts at the SQL layer and works back to objects. Both have advantages and disadvantages, and both have their use cases.
- smithjchris 17y agoIn single table inhertance, any leaf node from the inheritance graph cannot solely contain a relation to another object. It has to be on the abstract base or the ORM dies when building inserts for other leaf nodes. That leaves you to implement any business constraints on the model, but there is no model validation so it gets shifted into the controllers (or views as they call them). Not overly good.
- ubernostrum 17y agoPerhaps I'm misunderstanding you, but I regularly use abstract classes with subclasses which add relationships to other things, and I've not seen this problem.
- smithjchris 17y agoI'll write a test case and report it at some point. It's on my TODO. Also it's not been tried against 1.1 yet.