[Zope] SQL transaction uncommited?

Vlada Macek tuttle at bbs.cvut.cz
Mon Dec 19 11:39:32 EST 2005


[At 19.12.2005 01:39, Gabriel Genellina kindly sent the following
quotation.]


Gabriel, I appreciate you also reviewed my code.


>> def manage_afterAdd(self, item, container): if item is self:
>> self.db = getattr(self,MY_CONNECTION_ID)._v_database_connection
>
> Keeping a _v_ attribute is *not* a good idea - it's suposed to be
> *volatile*.

Later I moved the connection obj lookup to qry() method, so the
volatility of the attribute is not an issue now. I also learnt from
Shared/DC/ZRDB/Connection.py what you were talking about and changed
"._v_database_connection" to "()", which definitely looks cleaner. :-)

>> def qry(self, query): results = self.db.query(query) recs = {
>> 'names': Results(results).names(), 'tuples':
>> Results(results).tuples() } return recs
>
> Why create a Results object twice? results =
> Results(self.db.query(query))...

I also fixed this overlook later, thanks.

> I don't know how the ProgressSQL adapter is implemented, but *if*
> every query() call created a different connection or started a
> different transaction -which does not complete until the Zope
> transaction commits finally- *then* you would see those results.
> Updates made by the *same* transaction should always be available to
> that transaction, whatever the trans. isolation level in use. If this
> was the case, that may indicate that the Progress adapter is not
> properly written.

On psycopg mailing list I was informed that my problem is a known issue
of version 2.0b6 and that I should wait for b7 or take SVN head.

People, do not trust everything you are told on IRC. Sometimes it's
better to stay with stable releases, psycopg 1.1.18 works great and as
expected. :-)


-- 

\//\/\
(Sometimes credited as 1494 F8DD 6379 4CD7 E7E3 1FC9 D750 4243 1F05 9424.)



More information about the Zope mailing list