You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "./test.py", line 7, in <module>
cur.execute("SELECT DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%s');", tuple())
File "/.../lib/python3.8/site-packages/pymysql/cursors.py", line 146, in execute
query = self.mogrify(query, args)
File "/.../lib/python3.8/site-packages/pymysql/cursors.py", line 125, in mogrify
query = query % self._escape_args(args, conn)
TypeError: not enough arguments for format string
ISTM should behave as if None was passed:
row: ('2022-07-28 21:21:01',)
This is a pain because otherwise some exception handling is needed when there is no parameters.
The text was updated successfully, but these errors were encountered:
If it changes the behavior from error to working, I do not see how this would be a problem to anyone.
This is a pain because otherwise some exception handling is needed when there is no parameters.
You can pass None.
Sure, but I have a tuple of parameters, which may or may not be empty, thus it means having to test for changing the parameter everytime. Needing a special handling for 0 parameters is just a useless pain as it should be managed by the driver, IMHO.
Other drivers do not have such an issue: sqlite3, apsw, aiosqlite, psycopg, psycopg2, pygresql, asyncpg, pg8000, mysql-connector…
In PyMySQL 1.0.2
execute
does not like an empty tuple:Results in:
ISTM should behave as if
None
was passed:This is a pain because otherwise some exception handling is needed when there is no parameters.
The text was updated successfully, but these errors were encountered: