On 19 August 2013 14:22, Jay Pipes <jaypi...@gmail.com> wrote: >> I'm completely with Joshua here - the ORM layer is more often than not >> a source of bugs and performance issues. > > > If used improperly, yep.
http://www.codinghorror.com/blog/2006/06/object-relational-mapping-is-the-vietnam-of-computer-science.html There is no proper use of an ORM. >> We don't use the SQLAlchemy ORM for cross-SQL-DB support - thats a >> lower layer. It's the model objects themselves that we use the ORM >> for, and we could use SQLAlchemy's lower layers but not the ORM. > > > Hmmm, not quite... see below. > > >> An alternative I think would be better would be to scrap the use of >> the SQLAlchemy ORM; keep using the DB engine abstraction support. > > > Just keep in mind that the Session and Query objects and their related APIs > are in the SQLAlchemy ORM, not the SQLAlchemy Core. Ok, so either it's not a bright line, or we'd need to have an alternative thing - not just a reimplementation either, cause that's pointless. > But sure, ok. > > But then I guarantee somebody is gonna spend a bunch of time writing an > object-oriented API to the model objects because the ORM is very useful for > the data modification part of the DB interaction. !cite - seriously... > Because people will complain about having to do this: > > conn = engine.connection() > # instances is the sqlalchemy Table object for instances > inst_ins = instances.insert().values(blah=blah) > ip_ins = fixed_ips.insert().values(blah=blah) > conn.execute(ip_ins) > conn.execute(inst_ins) > conn.close() This strawman is one way that it might be written. Given that a growing set of our projects have non-SQL backends, this doesn't look like the obvious way to phrase it to me. > instead of this: > > i = Instance(blah=blah) > ip = FixedIp(blah=blah) > i.fixed_ips.append(ip) > session.add(u) > session.commit() > > And so you've thrown the baby out with the bathwater and made more work for > everyone. Perhaps; or perhaps we've avoided a raft of death-by-thousand-cuts bugs across the project. -Rob -- Robert Collins <rbtcoll...@hp.com> Distinguished Technologist HP Converged Cloud _______________________________________________ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev