[DB-SIG] spec: named parameters: clarification needed

M.-A. Lemburg mal@lemburg.com
Sat, 15 Feb 2003 09:30:57 +0100


Anthony Tuininga wrote:
> When I wrote cx_Oracle I assumed 2 but I have lately been told that
> other drivers have assumed 1 instead, so I am intending to implement
> both ways. Perhaps this should be clarified in the API document?

That's why I put up the question. Note that the .executeXXX()
APIs only define one parameter which is defined as sequence
or sequence of sequences, so both options conflict the spec
in some way.

Given that most drivers which use this param style seem
to implement option 2, I guess we should allow keyword
parameters to the .executeXXX() methods as well (provided
that .paramstyle is set to 'named').

> On Fri, 2003-02-14 at 12:38, M.-A. Lemburg wrote:
> 
>>Dittmar, Daniel wrote:
>>
>>>The spec says about param styles:
>>>
>>>'named'         Named style, e.g. '...WHERE name=:name'
>>>
>>>Does this mean that the driver has to accept dictionaries as the second argument to cursor.execute ()? Does this mean that driver has to accept only dictionaries?
>>>
>>>Stuart's dbapi20.py seems to assume this and I have at least one user that fell for it as well.
>>
>>Good question. Are there any modules out there actually implementing
>>this ?
>>
>>I see two interpretations here:
>>
>>1. .execute() gets a dictionary as parameter
>>2. .execute() gets keywords as parameter

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Software directly from the Source  (#1, Feb 15 2003)
 >>> Python/Zope Products & Consulting ...         http://www.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
Python UK 2003, Oxford:                                     45 days left
EuroPython 2003, Charleroi, Belgium:                       129 days left