[Zope-DB] Bug in ZSQL method result caching?

2006-02-24 Thread Chris Withers

Hi All,

I'm seeing a fair few errors as follows using Zope 2.8.4:

results = self.aZSQLMethod(p1=value1, p2=value2)
  File lib/python/Shared/DC/ZRDB/DA.py,line 453, in __call__
result=self._cached_result(DB__, (query, self.max_rows_))
  File lib/python/Shared/DC/ZRDB/DA.py,line 375, in _cached_result
if int(cache[q][0]) == key:
KeyError: (execute dbo.aStoredProcedure 'VALUE1', 'VALUE2'\n,
   1000,
   '\nDBConnId: None')

The code in question is this, from DA.py:

# Try to fetch from cache
if hasattr(self,'_v_cache'): cache=self._v_cache
else: cache=self._v_cache={}, Bucket()
cache, tcache = cache
max_cache=self.max_cache_
now=time()
t=now-self.cache_time_
if len(cache)  max_cache / 2:
keys=tcache.keys()
keys.reverse()
while keys and (len(keys)  max_cache or keys[-1]  t):
key=keys[-1]
q=tcache[key]
del tcache[key]
if int(cache[q][0]) == key:
del cache[q]
del keys[-1]


The if clause seems a bit dodgy...

Is that while loop maybe iterating over a mutable object while deleting 
stuff from it?


I'm only stabbing in the dark here...

Does anyone have any better ideas?

cheers,

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


[Zope-DB] Partial Data Replication to postgreSQL.

2006-02-24 Thread Sanjay Arora
We are considering Plone for CMS/Workflow app. However, some of the data from Zodb would need to be replicated into the existing postgreSQL CRM/SCM system, using triggers or something similar. What would be required to do the job?
With regards.Sanjay.
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


[Zope-DB] Query about trigger type replication from ZopeDB to postgreSQL

2006-02-24 Thread Sanjay Arora
We are considering Plone for CMS/Workflow app. However, some of the
data from Zodb would need to be replicated into the existing postgreSQL
CRM/SCM system, using triggers or something similar. What would be
required to do the job?

With regards.
Sanjay.

___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] import mysql

2006-02-24 Thread Chris Withers

[EMAIL PROTECTED] wrote:

does it exists a Product/Tool in zope / plone enviroment to achieve the
import of a big (my case) .sql file (MySQL) in a zope / Plone object or set
of obiects immediately available in zope / plone enviromenty itself?


Dunno what you're asking... if you want to import a load of rows into a 
MySQL table, just use MySQL's native tools.


If you want to create a load of Plohn objects from an MySQL dump, then 
your best bet is to write a migrator that uses a ZSQL method to iterate 
over a select of the data and create the Plohn objects in python...


cheers,

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk

___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db