[sqlalchemy] Automatic unique Many-To-Many Relationships

2013-01-06 Thread sjoerd
Hi, Is there a way for SQLAlchemy to silently avoid duplicate entries in a Many-To-Many Association Table? My current set-up; class UserRole(db.Model): __tablename__ = 'user_roles' id = Column(Integer, primary_key=True) rolename = Column(Unicode(80), unique=True) UserUserRoleTable

[sqlalchemy] zope.sqlalchemy - commit some objects on failure

2013-01-06 Thread Paul Johnston
Hi, I'm using zope.sqlalchemy in a web application (actually ToscaWidgets not Zope) so each request is wrapped in a transaction. If the request succeeds the transaction is committed; if there is an error it is rolled back. This works great. I have a log table where I log incoming XML to web

Re: [sqlalchemy] Automatic unique Many-To-Many Relationships

2013-01-06 Thread Michael Bayer
On Jan 6, 2013, at 6:48 AM, sjo...@congressus.nl wrote: Hi, Is there a way for SQLAlchemy to silently avoid duplicate entries in a Many-To-Many Association Table? My current set-up; class UserRole(db.Model): __tablename__ = 'user_roles' id = Column(Integer, primary_key=True)

Re: [sqlalchemy] zope.sqlalchemy - commit some objects on failure

2013-01-06 Thread Michael Bayer
On Jan 6, 2013, at 12:10 PM, Paul Johnston wrote: Hi, I'm using zope.sqlalchemy in a web application (actually ToscaWidgets not Zope) so each request is wrapped in a transaction. If the request succeeds the transaction is committed; if there is an error it is rolled back. This works

[sqlalchemy] custom __init__ methods not being invoked

2013-01-06 Thread RM
I have a class which inherits from Base. My class has a metaclass which inherits from DeclarativeMeta. Among other things, the metaclass adds an __init__ method to the class dictionary. When I instantiate an instance of my class directly, my __init__ method is invoked, but if I use the ORM to

Re: [sqlalchemy] How to handle 'sub-commits'?

2013-01-06 Thread Ken Lareau
Michael, Thanks for the response, see further questions/issues below... On Fri, Jan 4, 2013 at 8:41 AM, Michael Bayer mike...@zzzcomputing.comwrote: On Jan 3, 2013, at 10:18 PM, Ken Lareau wrote: I recently (today) ran into an issue that has me perplexed as to how to resolve it, so I'm