class documentation

class BufferedRowCursorFetchStrategy(CursorFetchStrategy):

View In Hierarchy

A cursor fetch strategy with row buffering behavior.

This strategy buffers the contents of a selection of rows before fetchone() is called. This is to allow the results of cursor.description to be available immediately, when interfacing with a DB-API that requires rows to be consumed before this information is available (currently psycopg2, when used with server-side cursors).

The pre-fetching behavior fetches only one row initially, and then grows its buffer size by a fixed amount with each successive need for additional rows up the max_row_buffer size, which defaults to 1000:

with psycopg2_engine.connect() as conn:

    result = conn.execution_options(
        stream_results=True, max_row_buffer=50
        ).execute(text("select * from table"))
New in version 1.4: max_row_buffer may now exceed 1000 rows.
Class Method create Undocumented
Method __init__ Undocumented
Method ​_buffer​_rows this is currently used only by fetchone().
Method fetchall Undocumented
Method fetchmany Undocumented
Method fetchone Undocumented
Method hard​_close Undocumented
Method soft​_close Undocumented
Method yield​_per Undocumented
Class Variable __slots__ Undocumented
Instance Variable ​_bufsize Undocumented
Instance Variable ​_growth​_factor Undocumented
Instance Variable ​_max​_row​_buffer Undocumented
Instance Variable ​_rowbuffer Undocumented

Inherited from CursorFetchStrategy:

Method handle​_exception Undocumented

Inherited from ResultFetchStrategy (via CursorFetchStrategy):

Class Variable alternate​_cursor​_description Undocumented
@classmethod
def create(cls, result):

Undocumented

def __init__(self, dbapi_cursor, execution_options, growth_factor=5, initial_buffer=None):

Undocumented

def _buffer_rows(self, result, dbapi_cursor):
this is currently used only by fetchone().
def fetchall(self, result, dbapi_cursor):
def fetchmany(self, result, dbapi_cursor, size=None):
def fetchone(self, result, dbapi_cursor, hard_close=False):
def hard_close(self, result, dbapi_cursor):
def soft_close(self, result, dbapi_cursor):
def yield_per(self, result, dbapi_cursor, num):
__slots__: tuple[str, ...] =
_bufsize =

Undocumented

_growth_factor: int =

Undocumented

_max_row_buffer =

Undocumented

_rowbuffer =

Undocumented