On Apr 10, 2007, at 5:33 AM, Koen Bok wrote:
>
> I'm trying to wrap my head around the threadlocal plugin to decide if
> we need it for our app.
you dont. dont use it. if it requires any kind of head wrapping,
then thats why i ripped it out of the core...youre better off
designing your own system, which then youll understand perfectly.
> We are building a GUI point of sale system.
> Until now I have done everything in sessions, basically in one global
> shared session.
use one session per thread.
> Basically we hoped that someone could compare the threadlocal strategy
> to the default strategy and some examples in what kind of apps you
> would use it.
the threadlocal strategy is only remotely useful if you are working
with explicit Connection and possibly Transaction objects, and its to
support replacing this pattern:
def do_function(conn):
conn.execute("foo")
def do_another_function(conn):
conn.execute("bar")
conn = engine.connect()
do_function(conn)
do_another_function(conn)
conn.close()
with this:
def do_function():
engine.contextual_connect().execute("foo")
def do_another_function():
engine.contextual_connect().execute("bar")
conn = engine.contextual_connect()
do_function()
do_another_function()
conn.close()
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---