Re: [Sqlalchemy-users] Externally Maintained Thread pools and SA 0.2

2006-05-29 Thread Michael Bayer
On May 29, 2006, at 11:33 AM, Brad Clements wrote: Or in other words, why can't I use the same code under both plain and threadlocal? you can. __del__ and close() are always available in the exact same way regardless of threadlocal status, both return the connection to the pool (in the

Re: [Sqlalchemy-users] Externally Maintained Thread pools and SA 0.2

2006-05-29 Thread Michael Bayer
hi list - Pursuant to this discussion, I propose we change the close() method, illustrated below: result = sometable.select().execute() result.close() to this: result = sometable.select().execute() result.close_connection() to eliminate confusion this may

Re: [Sqlalchemy-users] Externally Maintained Thread pools and SA 0.2

2006-05-29 Thread Brad Clements
On 29 May 2006 at 13:16, Michael Bayer wrote: Pursuant to this discussion, I propose we change the close() method, illustrated below: result = sometable.select().execute() result.close() to this: result = sometable.select().execute() result.close_connection() to eliminate

Re: [Sqlalchemy-users] Externally Maintained Thread pools and SA 0.2

2006-05-29 Thread Brad Clements
On 29 May 2006 at 13:09, Michael Bayer wrote: I want to use resultset.close() in ALL of my code, so that it will work correctly under either strategy. go nuts. should all work fine. all the work ive done in this area was designed specifically towards your request for this

Re: [Sqlalchemy-users] Externally Maintained Thread pools and SA 0.2

2006-05-29 Thread Michael Bayer
only because close does not do the traditional thing that close () does on a cursor object, which is simply close the cursor, but not affecting the connection which the cursor is assocaited with. this particular close() method insetad returns a connection to a connection pool. but it

Re: [Sqlalchemy-users] Externally Maintained Thread pools and SA 0.2

2006-05-28 Thread Valentino Volonghi aka Dialtone
On Sat, 27 May 2006 20:36:56 -0400, Michael Bayer [EMAIL PROTECTED] wrote: sure, right here: http://www.sqlalchemy.org/docs/dbengine.myt#dbengine_connections_context just switch on 'create_engine('foo', strategy=threadlocal)' and youve got identical 0.1 behavior. Not really since I tried

Re: [Sqlalchemy-users] Externally Maintained Thread pools and SA 0.2

2006-05-28 Thread Michael Bayer
creating the postgres engine with the separate QueuePool, like youre doing, is a good idea to get a better result here. the threadlocal strategy uses this silly TLEngine subclass which is only trying to do that old engine.begin()/engine.commit() thing, which id rather get rid of, as

Re: [Sqlalchemy-users] Externally Maintained Thread pools and SA 0.2

2006-05-28 Thread Michael Bayer
I have committed a new version of TLEngine which handles transaction context in the same way as that of SQLEngine in version 0.1, and added new unit tests that test the threadlocal and nesting behavior of this engine. the commit()/rollback() methods directly off the engine were not

Re: [Sqlalchemy-users] Externally Maintained Thread pools and SA 0.2

2006-05-28 Thread Valentino Volonghi aka Dialtone
On Sun, 28 May 2006 12:19:04 -0400, Michael Bayer [EMAIL PROTECTED] wrote: creating the postgres engine with the separate QueuePool, like youre doing, is a good idea to get a better result here. the threadlocal strategy uses this silly TLEngine subclass which is only trying to do that

Re: [Sqlalchemy-users] Externally Maintained Thread pools and SA 0.2

2006-05-28 Thread Michael Bayer
On May 28, 2006, at 2:36 PM, Valentino Volonghi aka Dialtone wrote: The new way of specifiying the dabatase parameters that uses an url is worse than the previous one IMHO since it doesn't allow me to avoid specifying an host and a port and I have to rely on passing my own QueuePool()

Re: [Sqlalchemy-users] Externally Maintained Thread pools and SA 0.2

2006-05-28 Thread Valentino Volonghi aka Dialtone
On Sun, 28 May 2006 14:51:55 -0400, Michael Bayer [EMAIL PROTECTED] wrote: On May 28, 2006, at 2:36 PM, Valentino Volonghi aka Dialtone wrote: The new way of specifiying the dabatase parameters that uses an url is worse than the previous one IMHO since it doesn't allow me to avoid

Re: [Sqlalchemy-users] Externally Maintained Thread pools and SA 0.2

2006-05-28 Thread Michael Bayer
this is unrelated to the URL scheme. i committed a one liner in 1539 that does not include the blank parameters in the keyword argument list if not found in the URL. to see why PG was doing this, try this: psycopg2.connect(database='blabla2', user='blalbla1', password='blabla', host='')

Re: [Sqlalchemy-users] Externally Maintained Thread pools and SA 0.2

2006-05-28 Thread Valentino Volonghi aka Dialtone
On Sun, 28 May 2006 15:10:37 -0400, Michael Bayer [EMAIL PROTECTED] wrote: if you are having deadlocks within one thread, that is almost certainly because you are using two simultaneous connections from the database, one of which has a lock on a table (due to a transaction) which the other

Re: [Sqlalchemy-users] Externally Maintained Thread pools and SA 0.2

2006-05-28 Thread Michael Bayer
heres the bug fix: --- lib/sqlalchemy/pool.py (revision 1540) +++ lib/sqlalchemy/pool.py (revision 1541) @@ -71,7 +71,7 @@ class Pool(object): def __init__(self, echo = False, use_threadlocal = True, logger=None, **kwargs): -self._threadconns = {}

Re: [Sqlalchemy-users] Externally Maintained Thread pools and SA 0.2

2006-05-27 Thread Ed Suominen
Michael Bayer wrote: why are you using twisted *with* threads ? didnt we all agree that was sort of unnecessary ? Twisted operates without needing to run *in* a thread by doing everything asynchronously. Every call made via the Twisted event loop must either return (synchronous) results very