MySQL ZXJDBC fails on metadata.create_all

Issue #1960 resolved
Former user created an issue

Bug is in dialects/mysql/base.py#has_table, on exception the orig attr is passed to _extract_error_code (mysql/zxjdbc.py) which expects the exception, not the orig attr, and fails hard. Attaching patch fixed running on Pylons/Pyramid application. This makes using mysql+zxjdbc impossible in current release!

Comments (6)

  1. Mike Bayer repo owner

    I'm fairly certain this should be the correct patch. Can you please test since I don't have easy access to Jython:

    diff -r 4700d344de77513c8ac9825c5a81bc3d5e2bffbd lib/sqlalchemy/dialects/mysql/zxjdbc.py
    --- a/lib/sqlalchemy/dialects/mysql/zxjdbc.py   Mon Nov 01 16:07:47 2010 -0400
    +++ b/lib/sqlalchemy/dialects/mysql/zxjdbc.py   Wed Nov 03 10:01:55 2010 -0400
    @@ -92,7 +92,7 @@
         def _extract_error_code(self, exception):
             # e.g.: DBAPIError: (Error) Table 'test.u2' doesn't exist
             # [1146](SQLCode:), [42S02](SQLState:) 'DESCRIBE `u2`' ()
    -        m = re.compile(r"\[(\d+)\](SQLCode\:)").search(str(exception.orig.args))
    +        m = re.compile(r"\[(\d+)\](SQLCode\:)").search(str(exception.args))
             c = m.group(1)
             if c:
                 return int(c)
    
  2. Log in to comment