[DB-SIG] API 3.0 limiting paramstyle to ['named', 'qmark'] is okay. ('format' is not desirable)
wilk
wilk at flibuste.net
Tue May 21 19:39:43 CEST 2013
On 19-05-2013, Carl Karsten wrote:
> I don't think it is reasonable to expect python's dbapi to be as db
> agnostic as we would like it to be.
Of course, we will not resolv this issue, sql code will still be
specific to database.
But, as a developer using differents databases, even if i accept to
write specific sql code, i like to use the same paramstyle. So i wrote
my own paramstyle with $x and write a litle wrapper to database
paramstyle (and i will gain 2 lines of code if i could know the
paramstyle from the connection). My own because it's a lot of corner
cases and i prefer to know exactly what i do...
Don't forget that a lot of developers tired of paramstyle
incompatibilities don't use any of them and use string concatenation
instead !
What do you think about qmark mandatory and an sqlparamters function in
stdlib ?
Maybe an extension of string format, it could be fine to can do:
i = "update mytable set x={v}".sqlformat
cursor.execute(i(v=5))
--
William Dodé
Informaticien Indépendant
More information about the DB-SIG
mailing list