It's my understanding that a lot of executemany() implementations will actually 
run the given statement once per each element in the sequence of parameters.  
such as, it creates a prepared statement handle for the statement, then runs 
each parameter set.  a driver that works this way can document that 
executemany() is guaranteed to invoke in that order, because it's a 
driver-determined behavior, not the database.

a driver that packages all the parameter sets into a single concatenated 
statement of course has a different story, they can't guarantee this order.

but in both cases it can be documented and in the former case it can be 
documented as the order being guaranteed also.

On Sun, Apr 9, 2023, at 5:19 AM, Tony Locke wrote:
> My initial thought is that the driver must pass the executemany
> parameters on to the server without changing the order of the
> parameters. Maybe that should be explicitly stated in the spec. Once
> the server has the parameters then I think the behaviour becomes DBMS
> dependent. I guess my philosophy is that the humble driver should just
> faithfully pass things back and forth while interfering as little as
> possible.
> 
> On Fri, 7 Apr 2023 at 19:09, Mike Bayer <mike...@zzzcomputing.com> wrote:
> >
> > OK that's two "sure, let's absolve ourselves of this problem" responses :)
> >
> > any opinion on executemany() being less useful if this requirement is not 
> > established, and/or encouraging DBAPI authors to at least *document* this 
> > themselves and maybe *prefer* maintaining ordering ?
> >
> >
> >
> > On Fri, Apr 7, 2023, at 1:54 PM, Erlend Egeberg Aasland wrote:
> >
> > On Fri, 7 Apr 2023 at 19:15, Mike Bayer <mike...@zzzcomputing.com> wrote:
> >
> >
> > […] The scope here is, should pep-249 add some verbiage: "the order in 
> > which parameters are processed by executemany() should not be assumed to be 
> > in the order the parameters were given". […]
> >
> >
> > Sounds good to me.
> >
> > Erlend
> >
> >
> >
> > _______________________________________________
> > DB-SIG maillist  -  DB-SIG@python.org
> > https://mail.python.org/mailman/listinfo/db-sig
> 
_______________________________________________
DB-SIG maillist  -  DB-SIG@python.org
https://mail.python.org/mailman/listinfo/db-sig

Reply via email to