I haven't ever observed it with MySQL-python however - we have many tests that raise exceptions and they work fine. In your own environment, a script like the following:
from sqlalchemy import *
e = create_engine('mysql://scott:tiger@localhost/test', echo=True)
e.execute("this is crap")
can confirm this. The stack trace needs to originate within the "execute()" chain within SQLA, goes down to default->do_execute(), then cursor.execute() on the MySQLdb side.
Assuming the above raises its error just fine as it does on my system, there must be some unusual pattern in the way the error is being generated. I don't know that there's anything on the SQLAlchemy side that can address this kind of thing in a consistent way, usually the strategy is to narrow down the series of DBAPI calls to a pure MySQL-python script that continues to reproduce. Its tricky though.
> --
> You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
> To post to this group, send email to sqlal...@googlegroups.com.
> To unsubscribe from this group, send email to sqlalchemy+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
>
> On Jan 22, 7:01 pm, Michael Bayer <mike...@zzzcomputing.com> wrote:
>> Assuming the above raises its error just fine as it does on my system, there must be some unusual pattern in the way the error is being generated. I don't know that there's anything on the SQLAlchemy side that can address this kind of thing in a consistent way, usually the strategy is to narrow down the series of DBAPI calls to a pure MySQL-python script that continues to reproduce. Its tricky though.
>
> I see... I did a few more tests, and it looks like the problem arises
> consistently when executing multiple statements having a syntax error
> in the second (or later) one..
>
> Extending your example:
>
> from sqlalchemy import *
> e = create_engine('mysql://scott:tiger@localhost/test', echo=True)
> e.execute("select * from validtable; this is crap")
Well that's your problem, that's not legal DBAPI usage. Its a bug IMHO in MySQLdb that it's accepted.