Re: [SQLObject] Connection instance ignored ?
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Stef T. <st...@um...> - 2009-02-09 17:35:49
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Oleg Broytmann wrote: > On Sun, Feb 08, 2009 at 06:16:01PM -0500, Stef Telford wrote: >> seeing about 190 connects/disconnects on the postgreSQL side. >> Now, since a connection is costly (believe me, it is ;), how can >> I get these down to (in theory) 1. I know that may seem >> unrealistic, but still, there shouldn't be 190 >> connects/disconnects. >> >> This -is- a single threaded environment, I do print out during >> the select in main.py and the connection -is- the same (same >> memory ref), I don't use selectBy either. >> >> I am kind of scratching my head here. Could it be that the joins >> in the class don't honor the classes connection? > > Whatever joins use - they use SQLObject's DBConnection objects that > are high-level wrapper around Python DB API connections. Every > DBConnection instance maintains a pool of opened DB API connections > and opens a new DB API connection only if the pool is empty (the > first query or all DB API connections are busy in other threads). > Hence there shouldn't be connects/disconnects, especially in a > single-threaded program. The only way to make implicit > connects/disconnects is to disable connection pooling. You haven't > done that, have you? connection._pool is not None? > > Oleg. Hello again Oleg, Actually, I -have- done this.. both with and without it seems to make no difference, I still get a tonne of connections :(. I have tried doing; > slaveConnection = getConnectionURI() slaveConnection._pool = None I have also tried specifically changing dbconnection.py self._pool = [] to self._pool = None .. no joy there either :( If I am doing something wrong, feel free to smack me upside the head and tell me ;) I am inheriting inside myclass from SQLObject, I am passing in the single connection via the overloaded get, _init and select/selectBy (not that I use selectBy but.. yes) Regards Stef -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFJkGltANG7uQ+9D9URAvFwAKCEHbonXnqgNSqCKrFW0RaUtFKHqACff+sZ b3Ud/xwYc86imYtDRNXwWFE= =Cagq -----END PGP SIGNATURE----- |