[Zope] Odd SQL errors- HELP

Jon Franz jfranz@one.net
Mon, 9 Oct 2000 14:32:13 -0400


Hello, I have Zope 2.2.2 running with a MySQL database, and 
everything _was_ working fine until I started to play with 
the new database structure our dba came up with for tracking
our recruiting process...
anyway, i have a db named recruit, with a MySQLDA connection
object to it that works, but on mnay of the tables I get an error
such as the one pasted below when I attempt to do a simple query...
Now, the state table does not return this error and has this 
structure: (as cut-n-pasted from the mysql monitor)
+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| state | char(2) |      | PRI |         |       |
+-------+---------+------+-----+---------+-------+

meanwhile any of our tables with 'id' fields choke with
the keyerror: unhandled, heres an example table struct:
+-------+--------------+------+-----+---------+----------------+
| Field | Type         | Null | Key | Default | Extra          |
+-------+--------------+------+-----+---------+----------------+
| id    | mediumint(8) |      | PRI | 0       | auto_increment |
| value | varchar(32)  |      |     |         |                |
+-------+--------------+------+-----+---------+----------------+

Now, at first i thought it was the field name of 'id' causing 
the problem, but now I've tried renaming the field and its still a no-go.
I can do queries such as 'select value from reason' fine, but if i select
* or the id field, it chokes... Looking through the mailinglist archives,
I think its a 'mapping error' where the ZmySQLDA doesn't properly map
this type of field for some reason... can someone help me solve this
problem?
Yes, I can change the db, but thats really not an acceptable option, since
the dba will then just go 'Well, if zope cant handle a simple db structure
without changing field name and/or types, then i refuse to sign off on
using zope as a development tool!'

>>>


Zope Error

Zope has encountered an error while publishing this resource.

Error Type: KeyError
Error Value: unhandled

Troubleshooting Suggestions
This resource may be trying to reference a nonexistent object or variable
unhandled.
The URL may be incorrect.
The parameters passed to this resource may be incorrect.
A resource that this resource relies on may be encountering an error.

For more detailed information about the error, please refer to the HTML
source for this page.

If the error persists please contact the site maintainer. Thank you for your
patience.

Traceback (innermost last):
  File /usr/local/zope/2.2.0/lib/python/ZPublisher/Publish.py, line 222, in
publish_module
  File /usr/local/zope/2.2.0/lib/python/ZPublisher/Publish.py, line 187, in
publish
  File /usr/local/zope/2.2.0/lib/python/Zope/__init__.py, line 221, in
zpublisher_exception_hook
    (Object: RoleManager)
  File /usr/local/zope/2.2.0/lib/python/ZPublisher/Publish.py, line 171, in
publish
  File /usr/local/zope/2.2.0/lib/python/ZPublisher/mapply.py, line 160, in
mapply
    (Object: manage_test)
  File /usr/local/zope/2.2.0/lib/python/ZPublisher/Publish.py, line 112, in
call_object
    (Object: manage_test)
  File /usr/local/zope/2.2.0/lib/python/Shared/DC/ZRDB/Connection.py, line
180, in manage_test
    (Object: RoleManager)
  File lib/python/Products/ZMySQLDA/db.py, line 191, in query
KeyError: (see above)