just deal with the session, and bind it to an engine.  saying  
"engine.connect()" does nothing down there since you arent holding  
onto anything.  the engine itself is stateless with regards to  
connections (unless you use the threadlocal strategy....which you  
shouldnt).

On Apr 10, 2007, at 5:16 AM, Koen Bok wrote:

>
>> the elegant way would be to not worry about the thread scope of a
>> connection and just use connection pooling normally.  pull out a
>> connection when needed, close it when complete (which is really just
>> a return to the connection pool).  keep the scope of those two
>> operations local to a single thread.
>
> This is exactly what I'd like to do. But I have no clue to assign a
> new connection to a session in a new thread. This is what I'm doing.
>
> class FlushThread(Thread):
>
>       def __init__(self, session):
>               super(FlushThread, self).__init__()
>               self.session = session
>               self.start()
>
>       def run(self):
>               print self.session
>               #engine.connect()
>               #self.session.bind_to(engine)
>               self.session.flush()
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to