meta.execute("query").fetchall() optional arguments problem with MySQL.
When running raw query with meta.execute("query").fetchall() without escaped arguments,
self.__distill_params(defined in base.py) returns an empty tuple.
But mysqldb's cursors.py wants to receive None, not empty tuple.
See stack trace below:
meta.execute(statement).fetchall() File "/Library/Python/2.6/site-packages/SQLAlchemy-0.6beta1-py2.6.egg/sqlalchemy/engine/base.py", line 1457, in execute return connection.execute(statement, multiparams, *params) File "/Library/Python/2.6/site-packages/SQLAlchemy-0.6beta1-py2.6.egg/sqlalchemy/engine/base.py", line 1035, in execute return Connection.executorsc(self, object, multiparams, params) File "/Library/Python/2.6/site-packages/SQLAlchemy-0.6beta1-py2.6.egg/sqlalchemy/engine/base.py", line 1111, in _execute_text return self.__execute_context(context) File "/Library/Python/2.6/site-packages/SQLAlchemy-0.6beta1-py2.6.egg/sqlalchemy/engine/base.py", line 1120, in __execute_context self._cursor_execute(context.cursor, context.statement, context.parameters0, context=context) File "/Library/Python/2.6/site-packages/SQLAlchemy-0.6beta1-py2.6.egg/sqlalchemy/engine/base.py", line 1180, in _cursor_execute self.dialect.do_execute(cursor, statement, parameters, context=context) File "/Library/Python/2.6/site-packages/SQLAlchemy-0.6beta1-py2.6.egg/sqlalchemy/engine/default.py", line 220, in do_execute cursor.execute(statement, parameters) File "/Library/Python/2.6/site-packages/MySQLdb/cursors.py", line 156, in execute query = query % db.literal(args)
Thanks, Didip Kerabat
Comments (1)
-
repo owner - Log in to comment
sorry, cannot reproduce. I see you're on an ancient 0.6beta1 version, which you should upgrade, and you also did not specify what MySQL DBAPI you're using or what version. Please reopen if you can provide enough detail.
output, with MySQLdb 1.2.3 final, just downloaded the latest: