On May 26, 5:09 pm, Michael Bayer <[EMAIL PROTECTED]> wrote:
> On May 26, 2008, at 6:20 PM, Waldemar Osuch wrote:
>
>
>
> >> Reading the docs for arraysize, its not clear if this only applies to
> >> fetchone() and a non-arg fetchmany(), or to all fetches (I'm hoping
> >> you have better detail on this.).  If the former, why not call
> >> fetchmany() or fetchall() ?  The ORM uses fetchall()/fetchmany() when
> >> receiving rows.   If the latter, that seems pretty strange that
> >> cx_oracle would still make 100 individual calls for a fetchmany(100)
> >> when just one would do.
>
> > Help is on the way
> >http://permalink.gmane.org/gmane.comp.python.db.cx-oracle/1325
>
> this is the same as the document which I read on the cx_oracle website.
>
> What happens if I say:
>
>         cursor.fetchall()
>
> ?
>
> does it make one "round trip" per row ?  or do a full fetch in one
> "round trip" ?  similar question for fetchmany(n).

The way I understand it does one "round trip" per row.

I have brought this thread to the attention of Anthony Tuininga
(the author of cx_Oracle).  His clarification follows.

Quote:

Up to this point the default arraysize is 1 meaning that a single row
is internally fetched at a time. This has nothing to do with
fetchone(), fetchmany() or fetchall(). Regardless of which of those
methods is used, internally cx_Oracle fetches one row at a time. If
you change the arraysize to 50, internally cx_Oracle will fetch 50
rows at a time. Again, this is regardless of whether you use
fetchone(), fetchmany() or fetchall(). Some of the confusion may lie
in the fact that the default value for rows to fetch in fetchmany() is
the arraysize -- but that is all it is, a default value!

In my own code I have created a subclass of cx_Oracle.Connection that
does the following:

class MyConnection(cx_Oracle.Connection):

   def cursor(self):
       cursor = cx_Oracle.Cursor(self)
       cursor.arraysize = 50
       return cursor

What this does is automatically set the arraysize to 50 every time a
cursor is created. This can be done to transparently set the arraysize
and should allow you to proceed with whatever code needs to assume an
arraysize of that value. Otherwise you can feel free to change it
yourself after creating the cursor.

And as has already been noted, in the next release of cx_Oracle, the
default arraysize will be 50 in order to resolve this problem
"permanently". :-)

Hope this helps.

Anthony
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to