[DB-SIG] API 3.0 limiting paramstyle to ['named', 'qmark'] is okay. ('format' is not desirable)

Vernon D. Cole vernondcole at gmail.com
Fri May 17 17:36:08 CEST 2013


If there are only the two styles, you can tell which is expected by looking
at the parameters.  If you have a sequence, you use 'qmark', if a mapping,
you use 'named'.  Follow the example of string.format() which will accept
either keywords or positional args.  Attempting to determine the style by
scanning the SQL is expensive and not a sure thing.


On Fri, May 17, 2013 at 4:15 PM, Michael Bayer <mike_mp at zzzcomputing.com>wrote:

>
> On May 17, 2013, at 11:10 AM, Christoph Zwerschke <cito at online.de> wrote:
>
> > Am 17.05.2013 17:01, schrieb Vernon D. Cole:
> > > What other options should be considered?
> >
> > Another option would be to get rid of the parameter completely, and
> silently accept both styles, whatever is used in the sql command passed to
> the execute method.
>
> that's how dbapi3 should work for sure.   for dbapi2 compatibility, some
> kind of switching would be needed.
>
>
>
>
> _______________________________________________
> DB-SIG maillist  -  DB-SIG at python.org
> http://mail.python.org/mailman/listinfo/db-sig
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/db-sig/attachments/20130517/93298afd/attachment.html>


More information about the DB-SIG mailing list