[Zope] ZSQL error using MySQLDA

Rick Ree Rick Ree <rree@oeb.harvard.edu>
Wed, 1 Sep 1999 20:40:59 -0400 (EDT)


On Thu, 2 Sep 1999, Anthony Baxter wrote:

> 
> >>> Rick Ree wrote
> > I have a MySQL query as follows:
> > 
> > select foo.id, bar.name, count(*)
> > from foo, bar
> > where (foo.id = bar.id)
> > group by foo.id
> 
> > Error, exceptions.KeyError: unhandled
> > 
> > Why might this be?  If I omit count(*) from the query it runs fine, or if
> > I use count(*) in a query involving only a single table, it also works. 
> 
> try this: 
> select foo.id, bar.name, count(*) as cnt
>  from foo, bar
>  where (foo.id = bar.id)
>  group by foo.id
> 
> The returned columns from an SQL query have to be named something that
> Zope can deal with (and have to be uniquely named).
> 

Hmmm... I did what you suggested and am still getting the same error
message.  Maybe this is a bug in ZMySQLDA?

As a workaround, I wrote an External Method that uses the python MySQL
module directly to execute the query, without problems.

--Rick