[Zope] SQL-Query works with MySQL-monitor but not with ZMySQL DA

Marcus Collins mcollins@sunesi.com
Mon, 29 May 2000 13:45:23 +0200


> -----Original Message-----
> From: Andy Pahne [mailto:ap@net22.net]
> Sent: 29 May 2000 13:03
> To: zope@zope.org
> Subject: [Zope] SQL-Query works with MySQL-monitor but not 
> with ZMySQLDA
> 
> Hi, there,
> 
> if I use my mysq-monitor to execute the following query, 
> everything works fine:
> 
>  SELECT YEAR(START_DATE) FROM EVENT;
> 
> but it doesn't work via the ZMySQLDA!?!
> 
> Here's the traceback:
> 
> Error, exceptions.KeyError: unhandled

[...]

IIRC, this problem (which occurs when the results of functions, instead of
columns, are returned) was mentioned some time back. You should be able to
resolve it by aliasing the result:

  select YEAR(START_DATE) as START_DATE_YEAR from EVENT

You can then refer to START_DATE_YEAR in your DTML.

hth,

-- Marcus