Am Montag 08 September 2008 13:29:17 schrieb Kyle Schaffrick: > On Mon, 8 Sep 2008 13:22:53 +0300 > > [EMAIL PROTECTED] wrote: > > maybe separate the objects to-be-saved from not-yet-to-save in your > > app.code and dont leave that to SA? > > do something, flush+commit, then do the rest... > > I agree, this seems like the best way to get what you want. SQL's > transaction semantics don't allow for cherry-picking what you want to > commit, and SA seems to reflect this atomicity in the design of Session.
I didn't get the whole discussion, but maybe it's possible to only add those objects to the session which you want to save? However - BEWARE of cascading rules, as they may add various other objects to the session. Moreover, note that the session is very picky about adding objects with cascading rules - if objects are already saved into the session, it may very well happen that some accompanied data is not flushed out. I'd therefore recommend to always check in a test that data is actually written to the database. Moreover, I'd really suggest to use autoflush, as I experienced some web-framework related problems without it and having flushing in mind during programming can be cumbersome. Btw., after working for some time with SA, sessions seem to be quite complicated and happend to be a source for various hard-tracking bugs in my application. What I think SA would really need is more documentation on sessions that describes how to embed session in an application, how to add objects to it (root to bottom / bottom to root) and what the pitfalls are. Best Regards, Hermann -- [EMAIL PROTECTED] GPG key ID: 299893C7 (on keyservers) FP: 0124 2584 8809 EF2A DBF9 4902 64B4 D16B 2998 93C7 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
