Dear all,
I'm trying to do the following query using mysql to display the tables
ending for an year:
show tables like '%2003'
No problem if I use the same sintax with the engine:
engine.execute("SHOW TABLES LIKE '%%2003'").fetchall()
But when I try to use a variable like an year:
year="2003"
engine.execute("SHOW TABLES LIKE '%%%s'"%year).fetchall()
I have the following error:
db=self.engine.execute("SHOW TABLES LIKE '%%%s'" % year).fetchall()
File
"/usr/lib/python2.4/site-packages/SQLAlchemy-0.1.5-py2.4.egg/sqlalchemy/engine.py",
line 691, in execute File
"/usr/lib/python2.4/site-packages/SQLAlchemy-0.1.5-py2.4.egg/sqlalchemy/engine.py",
line 711, in _execute SQLError: (ProgrammingError) not enough arguments
for format string "SHOW TABLES LIKE '%2003'" ()
In the latest line seems that the query was correct.
In other program context I use the same syntax whitout using engine
directly and works fine:
tableDatas=self.repair.select(self.repair.c.technician.like('%%%s%%'%technician)).execute().fetchall()
Where is the syntax error?
Thanks
--
-------------------------------------------------------------------
(o_
(o_ //\ Coltivate Linux che tanto Windows si pianta da solo.
(/)_ V_/_
+------------------------------------------------------------------+
| ENRICO MORELLI | email: [EMAIL PROTECTED] |
| * * * * | phone: +39 055 4574269 |
| University of Florence | fax : +39 055 4574253 |
| CERM - via Sacconi, 6 - 50019 Sesto Fiorentino (FI) - ITALY |
+------------------------------------------------------------------+
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users