[DB-SIG] API 3.0 limiting paramstyle to ['named', 'qmark'] is okay. ('format' is not desirable)
Michael Bayer
mike_mp at zzzcomputing.com
Fri May 17 18:41:04 CEST 2013
On May 17, 2013, at 12:33 PM, Christoph Zwerschke <cito at online.de> wrote:
> Am 17.05.2013 18:21, schrieb Daniele Varrazzo:
> > Quite the contrary: the quotes should never appear in the query and
> > these examples are correct but...
>
> Just tested this with psycopg2. If you use the clause "WHERE name=%s" and pass a value without quotes, you get a ProgrammingError from the database. So is psycopg2 not properly implementing DBAPI 2?
right, did you pass any parameters to execute()? I believe if no parameters are present, it decides not to do the "%" operation. Other DBAPIs that don't use format/pyformat don't have this behavior.
More information about the DB-SIG
mailing list