On Apr 4, 2007, at 11:45 AM, Arnar Birgisson wrote:

>
> Can I use the ORM inside after_update? I.e. can I create new instances
> of say HistoryLoggedItem which is a mapped class and expect that to be
> inserted in the same transaction, or do I need to insert explicitly
> into that table?

its not going to be able to modify the current flush() plan thats in  
progress, so youd either have to insert yourself, dispatch to  
class_mapper(HistoryLoggedItem).save_obj() yourself, or process the  
Session externally to the flush(), create the HLI items at that point  
and add them (by perusing session.dirty and processing).

the third option is slightly less automatic but would be the more  
official "OO" way to do it, being that SA is a library, not a  
framework.  when you try to add behavior by patching inside of SA's  
flush process, youre starting to use it as a framework.  Ive noticed  
the Python community *really* wants to turn things into frameworks :).

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to