Skip to content

Commit f9c1ca1

Browse files
author
James William Pye
committed
Document the changes to chunks().
1 parent 7be2622 commit f9c1ca1

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

postgresql/api.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,11 +498,13 @@ def chunks(self, *parameters) -> collections.Iterable:
498498
499499
Supporting cursors will be WITH HOLD when outside of a transaction.
500500
501-
`chunks` is designed for the situations involving large data sets.
501+
`chunks` is designed for moving large data sets efficiently.
502502
503503
Each iteration returns sequences of rows *normally* of length(seq) ==
504504
chunksize. If chunksize is unspecified, a default, positive integer will
505-
be filled in.
505+
be filled in. The rows contained in the sequences are only required to
506+
support the basic `collections.Sequence` interfaces; simple and quick
507+
sequence types should be used.
506508
"""
507509

508510
@abstractmethod

postgresql/documentation/changes.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ Changes
44
1.0 in development
55
------------------
66

7-
* Added db.do() method for DO-statement support(convenience method).
87
* **DEPRECATION**: Removed 2PC support documentation.
98
* **DEPRECATION**: Removed pg_python and pg_dotconf 'scripts'.
109
They are still accessible by python3 -m postgresql.bin.pg_*
10+
* Added db.do() method for DO-statement support(convenience method).
1111
* Fix handling of unix domain sockets by pg.open and driver.connect.
1212
[Reported by twitter.com/rintavarustus]
1313
* Set the default client_min_messages level to WARNING.
@@ -19,3 +19,5 @@ Changes
1919
* Increased default recvsize and chunksize for improved performance.
2020
* 'D' messages are special cased as builtins.tuples instead of
2121
protocol.element3.Tuple
22+
* Alter Statement.chunks() to return chunks of builtins.tuple. Being
23+
an interface intended for speed, types.Row() impedes its performance.

postgresql/documentation/driver.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ Prepared statement objects have a few execution methods:
511511
This access point is designed for situations where rows are being streamed out
512512
quickly. It is a method that returns a ``collections.Iterator`` that produces
513513
*sequences* of rows. This is the most efficient way to get rows from the
514-
database.
514+
database. The rows in the sequences are ``builtins.tuple`` objects.
515515

516516
``ps.declare(*parameters)``
517517
Create a scrollable cursor with hold. This returns a `postgresql.api.Cursor`
@@ -762,7 +762,7 @@ made the caller. This is done to avoid any unnecessary overhead by default::
762762

763763
Of course, invoking a statement that way will read the entire result-set into
764764
memory, which is not usually desirable for COPY. Using the ``chunks(...)``
765-
iterator is the fastest way to move data::
765+
iterator is the *fastest* way to move data::
766766

767767
>>> ci = ps.chunks()
768768
>>> import sys

0 commit comments

Comments
 (0)