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_metadata("blog")

Basically, I create an instance of DatabaseFacade for every web request and
DatabaseFacade relies on sac.session to manage db conn.

Is it optimal setup? What if make a DatabaseFacade created just once,
instead of per-request? Would it remain thread-safe?

I mainly ask because I was thinking about cache some database data and for
this to more I need a permanent facade instance.
I also realise that suboptimal setup and concurrency problems may be not
obvious until the site got high load...

Thanks,
Max.

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

Reply via email to