[sqlalchemy] SQLAlchemy training sessions

2012-09-12 Thread erikj
Hello, For the second time this year, we are organizing a SQLAlchemy training day. So if you or your colleagues need to get up and running with SQLAlchemy, this is your chance. - October 27 : Leipzig, Germany (this is the weekend right before PyConDE) - November 15 : Antwerp, Belgium

[sqlalchemy] safe usage within before_update/before_insert events

2012-09-12 Thread Kent
You've mentioned multiple times (to me and others) that some operations, such as reaching across relationships or loading relationships from within a before_update Mapper event is not safe. - I understand this is safe from within Session event before_flush(), correct? - We mentioned

Re: [sqlalchemy] Re: safe usage within before_update/before_insert events

2012-09-12 Thread Michael Bayer
On Sep 12, 2012, at 2:33 PM, Kent wrote: Posted before I was done, sorry... Is it safe to do all these things from Mapper event after_update? relationships that are being persisted in that flush are not necessarily done being persisted, so loading a relationship is not a great idea in

Re: [sqlalchemy] Re: safe usage within before_update/before_insert events

2012-09-12 Thread Michael Bayer
On Sep 12, 2012, at 5:12 PM, Kent wrote: I should step back and present my current issue: When updates to instances of a certain class (table) are to be issued, there are sometimes other related updates that need to be made also. But I need to be able to flush() these changes in between

[sqlalchemy] autocommit=False, autoflush on begin, after_flush event, unintended side effect?

2012-09-12 Thread Yap Sok Ann
This is semi-related to the latest post from Kent. I just noticed that I have been abusing the autoflush on begin behavior (by the _take_snapshot() method in orm/session.py) to create additional instances within the after_flush Session Event. Here's some sample code to illustrate that: