Error due to MySQL-Python at 1.2.3?

46 views
Skip to first unread message

Ben Cheng

unread,
Mar 6, 2009, 6:13:10 AM3/6/09
to sqlalchemy
Hi,

I'm not sure is it a bug of SQLAlchemy or MySQL-Python, may some one
advice or if you know any related tickets?

When I'm using SQLAlchemy on MySQL-Python 1.2.3, it shows error on the
following SQL when I call create_all:

19:05:33,895 INFO [sqlalchemy.engine.base.Engine.0x...a0f0] SHOW
VARIABLES LIKE 'sql_mode'
19:05:33,895 INFO [sqlalchemy.engine.base.Engine.0x...a0f0] ()
19:05:33,934 INFO [sqlalchemy.engine.base.Engine.0x...a0f0] DESCRIBE
`forms`
19:05:33,935 INFO [sqlalchemy.engine.base.Engine.0x...a0f0] ()
19:05:33,947 INFO [sqlalchemy.engine.base.Engine.0x...a0f0] ROLLBACK

sqlalchemy.exc.ProgrammingError: (ProgrammingError) (1146, "Table
'voters.forms' doesn't exist") 'DESCRIBE `forms`' ()

But when I roll-back to MySQL-Python 1.2.1, the error gones.

Any thought?

Best,
Ben

Michael Bayer

unread,
Mar 6, 2009, 11:50:19 AM3/6/09
to sqlal...@googlegroups.com
looks like MySQL-Python changed their exception format again. here's
our current code:

try:
rs = connection.execute(st)
have = rs.rowcount > 0
rs.close()
return have
except exc.SQLError, e:
if e.orig.args[0] == 1146:
return False
raise

so obviously the e.orig.args[0] is not finding the code again.
maybe someone has time to look at this with mysql 1.2.3 ?

Michael Bayer

unread,
Mar 7, 2009, 12:17:32 PM3/7/09
to sqlal...@googlegroups.com
can you please report this as a bug in MySQL 1.2.3b1. The exception
raised looks like this in pdb:

ProgrammingError(ProgrammingError(1146, "Table 'test.t1' doesn't
exist"),)


i.e., it raises a ProgrammingError, where first argument is in fact
another instance of ProgrammingError. We can work around this in
the MySQL dialect but I would rather wait until a final version of
1.2.3 is released, hopefully with this bug fixed. this is how it
should look:

ProgrammingError(1146, "Table 'test.t1' doesn't exist")
(Pdb) e.args
(1146, "Table 'test.t1' doesn't exist")



On Mar 6, 2009, at 6:13 AM, Ben Cheng wrote:

>

Michael Bayer

unread,
Mar 7, 2009, 12:25:40 PM3/7/09
to sqlal...@googlegroups.com

Ben

unread,
Mar 7, 2009, 12:31:55 PM3/7/09
to sqlal...@googlegroups.com
Thanks a lot~ I should have added it earlier. Ben

--
Ben Cheng | Software Architect | Oursky Ltd. | M +852 9381-6083 |
www.bencheng.net
Reply all
Reply to author
Forward
0 new messages