> 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 [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
-~----------~----~----~----~------~----~------~--~---

Reply via email to