[Zope-DB] optional arguments to zsql methods

garry garry at schoolteachers.co.uk
Wed Feb 22 16:10:20 EST 2006

I am importing a large data set via Zope into a Postgres database. Data
items may or may not exist so I am using the optional argument in the
zsql methods. What I want is that if the data is missing the database
inserts default values.

if type="string", the absent data item is rendered as ''

if type="nb", the absent data item is rendered as 'Null'

In either case this does not allow default values to be inserted. I can
insert the defaults by doing this:
<dtml-if surnamefirst>
  <dtml-sqlvar  surnamefirst   type="string"> ,

With 20 or so inserts in one query this gets messy and could be slow? if
this method has to be called many times on one import cycle.
My question is therefore is there a cleaner way of doing this or am I on
the right track?

More information about the Zope-DB mailing list