On Sep 2, 11:29 pm, "Mike Orr" <[EMAIL PROTECTED]> wrote: > It's a matter of thinking the opposite. Because new objects are > automatically saved, you don't have to .save them to get them into he > database. Instead you have to .expunge() the ones you *don't* want > saved in the database, and do that early enough that it doesn't get > written.
This is a good way to think about it. I do appreciate the 'autosave' feature. In my project I do want my object to be saved most of the time. It's tedious and error prone to remember to session.save() every new object I create. Since the expunge case is not that common, I'd rather do it for the one or two cases where 'autosave' does not work for me. > On 9/1/07, Haseeb <[EMAIL PROTECTED]> wrote: > > > > > You're right - I am using Session.mapper which I took off the pylons > > tutorials. I'm mainly using Session.mapper to get the old assignmapper > > functionality of the 0.3x tree. Is there a way to get assignmapper > > functionality in 0.4x without losing the ability to control when an > > object gets added to the session? > > But in 0.3 you didn't have control over when objects got added to the > session either. > > The problem was that 0.3 presented assignmapper's main feature as this > autosaving, and oh by the way it did queries too. So people who > wanted convenient queries used assignmapper and just put up with the > autosaving or learned to enjoy it. In 0.4 the two features are > presented as co-equal, but they're still cojoined so you either get > both or neither. But really, they aren't similar features so there's > no reason to cojoin them. If I had to choose one feature or the > other, I'd definitely prefer .query. There's an argument to be made > that saving should be explicit; it prevents things from getting > inserted that you didn't intend to. > > -- > Mike Orr <[EMAIL PROTECTED]> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
