[Zope-dev] Flat Database/ZPatterns api, performance ?

Simon Michael simon@joyful.com
26 Oct 2000 10:35:57 -0700


Flat Database (was ListMate) is just what I need to whip up an
interface for non-technical administrators - thanks. So I migrated two
data tables ("workshops" & "registrations") from gadfly to flatdb
instances using the CSV import feature, and the admin interface is
working fine.

I'm having a hard time, though, figuring out how to access the data
programmatically. I scavenged the docs (zpatterns wiki very helpful,
as far as it went; not much available for flatdb), searched the lists
(nothing) and grovelled around in the code. I'd appreciate any
comments or advice on the following.

1. how can I look up a row in the table by column value, other than
searching the whole table: ?

  <dtml-in "workshops.entryValues()">
  <dtml-if "getProperty('col_workshopid') == workshop">
  <dtml-var "getProperty('col_description')">
  </dtml-if>
  </dtml-in>

2. how can I add an entry to a table ? I tried this:

  <dtml-let entry="registrations.manage_addEntry()">
  <dtml-call "entry.manage_addProperty('col_workshopid','string','TEST')">
  <dtml-call "entry.manage_addProperty('col_firstname','string','TEST')">
  <dtml-call "entry.manage_addProperty('col_lastname','string','TEST')">
  ...
  </dtml-let>

and it seems to create a number of spurious rows with only the first
field set. This didn't work either:

  <dtml-call "registrations.manage_addEntry().manage_changeProperties(
  col_workshopid='TEST', col_firstname='TEST', col_lastname='TEST', ... )">

3. displaying table contents seems quite slow. On this P100 with 48Mb
ram doing nothing but zope, no load and generally snappy, generating
the 50-row, 20-column registrations table listing takes 15
seconds. Any ideas about where this comes from ?

4. this is my first encounter with the mighty zpatterns. I wonder how
one might add a thing (data plugin ?) so that FlatDb could read the
data out of zgadfly or something faster, instead of migrating it as I
did ?

Many thanks!
-Simon