Re: [SQLObject] Bug? Spurious connection to postgresql
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Oleg B. <ph...@ph...> - 2008-12-13 17:39:26
|
On Sat, Dec 13, 2008 at 07:26:14PM +0200, Iwan Vosloo wrote: > In pgconnection.py, line: > 163 if self.server_version[:3] <= "7.2": > > the attribute access to server_version results in a "poor mans > aquisition" call to the method server_version on the Transaction's > _dbConnection (a PostgresConnection). > > In there, on line: > 304 server_version = self.queryOne("SELECT version()")[0] > > A query is executed on the underlying db connection. > > This is where the extra connection is created (the original is already > in a transaction at this point). If this query is done manually on the > Transaction object, instead of on its underlying connection, everything > works as it should. > > So, it seems (from our limited understanding) that it should not have > gone this far, and rather should have executed the query on the > Transaction object itself. When the connection calls self.queryOne() - is 'self' the connection or the transaction? Transaction overrides queryOne method to pass the existing connection instead of creating a new one, but from you exploration it seems the overridden method is not called, instead the connection calls original queryOne and creates a new low-level connection. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |