On 2015-05-25 11:12 Mike Bayer <mike...@zzzcomputing.com> wrote: > CreateSession and sessionmaker do the same thing. I'd lose one or > the other.
Yes, I will do so. > For the memoized thing, I'd use a decorator like Pyramid @reify or > SQLAlchemy's @memoized_property, wouldn't bother with all those > conditionals and such. I am quite new to Python and not familiar with the decorator concept. What do you mean with "memoized thing"? And why could the decorators help me here? > As for "the session would be destroyed/closed", I'd never rely on > that, I see. The link helped. Of course the Gui-Dialog related to such a Controller instance will call a SessionCommit() ('OK' is pressed) or SessionRollback() ('Cancel' is pressed). So the controller instance itself call commit() or rollback() on its session object. Maybe you could implement a BasicController.__del__() to check the state of the Session if it is commited or rolled back. I mean if someone missed to call commit() or rollback() on int. But I am not sure if it is possible to ask a Session object for things like that. What do you think? > that's a poor design, and it will lead to problems like > connection pool overflows and deadlocks. I understand that. I thought the Session object would be destroyed automaticly when the controller is destroyed. And I think the Session take care of itself to release the resources while it is destroyed. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.