More ZMySQLDA troubleshooting w/ Zope 2.0.0
OK, so I figured out what it is that the interface doesn't seem to like about my queries. First, a recap of the general error and traceback: --- Error, exceptions.KeyError: unhandled SQL used: select sessioncode from users limit 10 Traceback (innermost last): File /usr/local/dc/Zope-2.0.0/lib/python/ZPublisher/Publish.py, line 214, in publish_module File /usr/local/dc/Zope-2.0.0/lib/python/ZPublisher/Publish.py, line 179, in publish File /usr/local/dc/Zope-2.0.0/lib/python/Zope/__init__.py, line 201, in zpublisher_exception_hook (Object: test_auction_listing) File /usr/local/dc/Zope-2.0.0/lib/python/ZPublisher/Publish.py, line 165, in publish File /usr/local/dc/Zope-2.0.0/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: manage_test) File /usr/local/dc/Zope-2.0.0/lib/python/ZPublisher/Publish.py, line 102, in call_object (Object: manage_test) File /usr/local/dc/Zope-2.0.0/lib/python/Shared/DC/ZRDB/DA.py, line 316, in manage_test (Object: test_auction_listing) File /usr/local/dc/Zope-2.0.0/lib/python/Shared/DC/ZRDB/DA.py, line 297, in manage_test (Object: test_auction_listing) File /usr/local/dc/Zope-2.0.0/lib/python/Shared/DC/ZRDB/DA.py, line 401, in __call__ (Object: test_auction_listing) File lib/python/Products/ZMySQLDA/db.py, line 191, in query KeyError: (see above) --- After some trial and error, I discovered that db.py is apparently bombing on columns of type bigint and mediumint. "sessioncode" in the above example is a bigint column type, and if I select a char, decimal, or smallint column instead, the query runs fine (although an unsigned smallint will come back with an "L" appended to each number). I'm now using MySQL version 3.22.25-log after upgrading my Debian installation to unstable for the hell of it. Any idea what might be causing this problem, and if there's a workaround I can implement in my query? Will the MySQL db interface for Python that was just released into beta handle this situation better? Thanks, I hope I'm closing in on a solution, -->ben
On Thu, 16 Sep 1999, ben andrew fulton wrote:
After some trial and error, I discovered that db.py is apparently bombing on columns of type bigint and mediumint. "sessioncode" in the above example is a bigint column type, and if I select a char, decimal, or smallint column instead, the query runs fine (although an unsigned smallint will come back with an "L" appended to each number). I'm now using MySQL version 3.22.25-log after upgrading my Debian installation to unstable for the hell of it. Any idea what might be causing this problem, and if there's a workaround I can implement in my query? Will the MySQL db interface for Python that was just released into beta handle this situation better?
There is a dictionary in ZMySQLDA which maps MySQL column types to certain format codes. Look in lib/python/Products/ZMySQLDA/db.py around line 120 in class DB, attribute defs. You can probably add another element or two to accomodate these types. The other thing you can do is try the newer MySQLdb-0.1.0, and apply the enclosed ZMySQLDA.patch. I reworked this some more yesterday and I think it's pretty close to being finished. At least, I've done some testing on it and can't find a case where it's borken. The only suspected place where there will probably be trouble is if you have some LONG LONG columns. In fact, I just dug through lib/python/shared/DC/ZRDB/RDB.py and it appears the correct code I should be using is "l" there. I just now fixed this, and the updated tarball is available at: http://starship.python.net/crew/adustman So... now there are no known bugs. :) -- andy dustman | programmer/analyst | comstar.net, inc. telephone: 770.485.6025 / 706.549.7689 | icq: 32922760 | pgp: 0xc72f3f1d
participants (2)
-
Andy Dustman -
ben andrew fulton