[DB-SIG] Clarification of cursor.arraysize

Carsten Haese carsten at uniqsys.com
Tue Dec 19 01:26:46 CET 2006


On Mon, 2006-12-18 at 16:56 -0500, Art Protin wrote:
> Dear folks,
>     I find yet again that I am confused by what I read in pep-0249.  
> This time it is the last line describing the attribute of cursor objects 
> named .arraysize (I quote here both paragraphs):
> 
>     This read/write attribute specifies the number of rows to
>     fetch at a time with fetchmany().  It defaults to 1 meaning
>     to fetch a single row at a time.
> 
>     Implementations must observe this value with respect to
>     the fetchmany() method, but are free to interact with the
>     database a single row at a time.  It may also be used in
>     the implementation of executemany().
> 
> I fail to grasp how .arraysize could have any bearing on .executemany() 
> or for that matter any operation other than fetchmany().  Thus I find I 
> must request aid in understanding what the intent is here - HELP,  please.

It says "It *may* be used in the implementation of executemany()." I
imagine this would be useful for a database API that allows passing
parameters in bulk. You're free to implement executemany() without
referring to arraysize if there is no advantage in referring to
arraysize.

>       While I am bothering you good people with my silly questions, I 
> might just as well tack on another:  if one invokes .executemany with a 
> seq_of_parameters that is empty (like
> 
> a_cursor.executemany(SQL, [])
> 
> ) shouldn't the interface module execute the query zero times, ie, not 
> execute the query at all?

Yes, executemany() with an empty sequence is a no-op.

-- 
         Carsten Haese          |  Phone:       (419) 861-3331
       Software Engineer        |  Direct Line: (419) 794-2531
      Unique Systems, Inc.      |  FAX:         (419) 893-2840
      1687 Woodlands Drive      |  Cell:        (419) 343-7045
       Maumee, OH  43537        |  Email:       carsten at uniqsys.com



More information about the DB-SIG mailing list