[sqlalchemy] Correct way to delete Association Objects

2011-08-24 Thread Benjamin Sims
I have a many-to-many relationship with attributes: Parent - AssocObject - Child I'm trying to set it up so that when an AssocObject is removed from parent, that instance of AssocObject and the Child are also deleted. So in my view I do: del parent.associatedobjects I have changed the model so

Re: [sqlalchemy] 'MySQL server has gone away' problem

2011-08-24 Thread Michael Bayer
On Aug 23, 2011, at 11:21 PM, limodou wrote: On Sat, Oct 23, 2010 at 9:22 PM, Michael Bayer mike...@zzzcomputing.com wrote: pool recycle means a connnection that is 3600 seconds old will be thrown away. does not help with reconnects. When a server gone away error is detected, the

Re: [sqlalchemy] Correct way to delete Association Objects

2011-08-24 Thread Michael Bayer
cascade should be all, delete-orphan.by saying delete, delete-orphan you cancel out other cascades that are there, most notably save-update which makes sure everything gets moved into the same Session. On Aug 24, 2011, at 7:07 AM, Benjamin Sims wrote: I have a many-to-many relationship

Re: [sqlalchemy] 'MySQL server has gone away' problem

2011-08-24 Thread limodou
On Wed, Aug 24, 2011 at 9:49 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Aug 23, 2011, at 11:21 PM, limodou wrote: On Sat, Oct 23, 2010 at 9:22 PM, Michael Bayer mike...@zzzcomputing.com wrote: pool recycle means a connnection that is 3600 seconds old will be thrown away.   does

Re: [sqlalchemy] 'MySQL server has gone away' problem

2011-08-24 Thread Michael Bayer
On Aug 24, 2011, at 10:04 AM, limodou wrote: finally I found the problem. In my case I build my own ORM based on sqlalchemy, I call it uliorm. And it only use base select, update, insert, delete statements. And in order to keep the whole process can share the same connection object, I used

[sqlalchemy] Re: InstrumentedList/InstrumentedAttribute to dynamic query

2011-08-24 Thread Ahmed
It seems I am very close to an answer by Michael Bayer demonstrated in that thread: http://groups.google.com/group/sqlalchemy/browse_thread/thread/2f60ee62e1ed6a0a I changed the strategies on the class mapper RelationshipProperties as follows: def make_dynamic(sqlalchemy_class): mapper =

Re: [sqlalchemy] Re: InstrumentedList/InstrumentedAttribute to dynamic query

2011-08-24 Thread Michael Bayer
On Aug 24, 2011, at 11:12 PM, Ahmed wrote: It seems I am very close to an answer by Michael Bayer demonstrated in that thread: http://groups.google.com/group/sqlalchemy/browse_thread/thread/2f60ee62e1ed6a0a I changed the strategies on the class mapper RelationshipProperties as follows: