Hi Vernon and all,
On Friday 17 May 2013, VernonCole wrote:
> Shai:
>
> I think that you are showing how rotten this whole "paramstyle" mess is:
> the thing you are describing is, IIUC, "pyformat" paramstyle. "named" uses
> a ":name" SQL statement syntax, and expects a mapping of parameters. My
> understanding was that Oracle expected that one. I am only an egg.
>
Oracle (as in, its C libraries) indeed expects named (":name") parameters, and
so (AFAIK) does cx_Oracle.
> Here's my understanding:
>
[...]
>
> 'pyformat' uses "%(name)s", and expects parameters in a mapping.
>
> The intent of PEP-249 is that the ORM should look at the value of
> adapter.paramstyle and use that format, whatever it happens to be.
>
As you mentioned in your first message, we are talking here about raw selects,
and not ORM-written queries. I hope we can make those standard in the sense
that standard SQL can be written cross-database; I have almost no preference
among the competing paramstyles, as long as some form where parameters are
passed in a mapping and referenced by name is supported.
For the record, I am currently interested in having the same code run against
SQLite, PostgreSQL, Oracle and MSSQL.
> Clearly, that is not happening. Should it be put on the To-do list for
> some future version of django, at least to supporting the two expected
> future winners in the parmstyle competition ('named', 'qmark')?
As far as I know, all current core backends support 'format' ("%s") and
'pyformat' ("%(name)s"), except Oracle/pyformat (which my patch fixes). Oracle
is unique among the core backends in not passing the arguments received to the
interface library as received, but reconstructing its own params structure --
mostly on account of cx_Oracle supporting only 'named' paramstyle.
Have fun,
Shai.