database best practices: how to manage sac

2007-08-01 Thread Max Ischenko
Hi, I'm using SAContext to manage my SQLAlchemy database connections. Today setup looks like this. BaseController.__call__: model.sac.session.clear() self.db = model.DatabaseFacade() And DatabaseFacade.__init__: self.session = sac.session self.meta = sac.get_met

Re: database best practices: how to manage sac

2007-08-01 Thread jose
I didn't think you had to do that, I thought all you had to do was use sac directly. so in your base you could add from model import sac I think That should work Jose On Aug 1, 1:30 am, "Max Ischenko" <[EMAIL PROTECTED]> wrote: > Hi, > > I'm using SAContext to manage my SQLAlchemy database conn

Re: database best practices: how to manage sac

2007-08-02 Thread Mike Orr
On 8/1/07, Max Ischenko <[EMAIL PROTECTED]> wrote: > Hi, > > I'm using SAContext to manage my SQLAlchemy database connections. Today > setup looks like this. > > BaseController.__call__: > > model.sac.session.clear() > self.db = model.DatabaseFacade() > > And DatabaseFacade.__

Re: database best practices: how to manage sac

2007-08-07 Thread Max Ischenko
Hello Mike, On 8/3/07, Mike Orr <[EMAIL PROTECTED]> wrote: > > > > Is it optimal setup? What if make a DatabaseFacade created just once, > > instead of per-request? Would it remain thread-safe? > > No. sac.session is the session appropriate to the current thread (and > application for multi-app

Re: database best practices: how to manage sac

2007-08-07 Thread jose
Dear Max, I just found out that we should be deleting the current session in base.py. So in base.py you should have del model.sac.session_context.current which effectively would "clear" the session which is what I think you wanted from your original post See the thread that I started about t

Re: database best practices: how to manage sac

2007-08-08 Thread voltron
Hi Jose! Now I´m confused, I thought one was supposed to delete the sessions at the beginning of the controller function in question, does putting the call in base.py eliminate the need to add del calls in every controller function? Thanks On Aug 8, 5:33 am, jose <[EMAIL PROTECTED]> wrote: > D

Re: database best practices: how to manage sac

2007-08-08 Thread Daniel Tang
Yes it does, since it's in the base controller. On 8/8/07, voltron <[EMAIL PROTECTED]> wrote: > > Hi Jose! > > Now I´m confused, I thought one was supposed to delete the sessions at > the beginning of the controller function in question, does putting > the call in base.py eliminate the need to a

Re: database best practices: how to manage sac

2007-08-08 Thread voltron
Cool, nice to know! On Aug 8, 7:19 pm, "Daniel Tang" <[EMAIL PROTECTED]> wrote: > Yes it does, since it's in the base controller. > > On 8/8/07, voltron <[EMAIL PROTECTED]> wrote: > > > > > Hi Jose! > > > Now I´m confused, I thought one was supposed to delete the sessions at > > the beginning of

Re: database best practices: how to manage sac

2007-08-08 Thread Max Ischenko
Hi Jose, On 8/8/07, jose <[EMAIL PROTECTED]> wrote: > > I just found out that we should be deleting the current session in > base.py. So in > > base.py you should have > > del model.sac.session_context.current > > which effectively would "clear" the session which is what I think you > wanted from