[SQLObject] Connection instance ignored ?
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Stef T. <st...@um...> - 2009-02-08 23:16:05
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hey Oleg, Everyone, So, I have currently subclassed SQLObject to MySQLObject, as I am trying to basically do one connection to a slave, another to a master. Hopefully, that makes sense so far. In my class I have subclassed get and select to use an existing connection. Eg; > @classmethod > def select(self, clause=None, **kwargs): > ''' All selects should go through the slave connection ''' > global slaveConnection > if slaveConnection: > kwargs['connection']=slaveConnection > return super(CompassObject, self).select(clause, **kwargs) and the same for 'get' as well.. the curious thing is, I am still 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 ? (would be kind of strange and not at all what I would expect.. nor do I see that the code is creating a new connection). Any thoughts/ideas gratefully welcomed ;) Regards Stef -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFJj2exANG7uQ+9D9URApPRAKCFyMWs7eM4DDB1wYSQsGcRbbvoZgCdEPOQ Ru1Xc6xHVkceP0Hd21eLIMM= =WPA5 -----END PGP SIGNATURE----- |