pgdb.Cursor - pydoc - phpman

Look up a command

 

Markdown Format | JSON API | MCP Server Tool


Help on class Cursor in pgdb:

pgdb.Cursor = class Cursor(builtins.object)
 |  pgdb.Cursor(dbcnx)
 |
 |  Cursor object.
 |
 |  Methods defined here:
 |
 |  __enter__(self)
 |      Enter the runtime context for the cursor object.
 |
 |  __exit__(self, et, ev, tb)
 |      Exit the runtime context for the cursor object.
 |
 |  __init__(self, dbcnx)
 |      Create a cursor object for the database connection.
 |
 |  __iter__(self)
 |      Make cursor compatible to the iteration protocol.
 |
 |  __next__(self)
 |      Return the next row (support for the iteration protocol).
 |
 |  build_row_factory(self)
 |      Build a row factory based on the current description.
 |
 |      This implementation builds a row factory for creating named tuples.
 |      You can overwrite this method if you want to dynamically create
 |      different row factories whenever the column description changes.
 |
 |  callproc(self, procname, parameters=None)
 |      Call a stored database procedure with the given name.
 |
 |      The sequence of parameters must contain one entry for each input
 |      argument that the procedure expects. The result of the call is the
 |      same as this input sequence; replacement of output and input/output
 |      parameters in the return value is currently not supported.
 |
 |      The procedure may also provide a result set as output. These can be
 |      requested through the standard fetch methods of the cursor.
 |
 |  close(self)
 |      Close the cursor object.
 |
 |  copy_from(self, stream, table, format=None, sep=None, null=None, size=None, columns=None)
 |      Copy data from an input stream to the specified table.
 |
 |      The input stream can be a file-like object with a read() method or
 |      it can also be an iterable returning a row or multiple rows of input
 |      on each iteration.
 |
 |      The format must be text, csv or binary. The sep option sets the
 |      column separator (delimiter) used in the non binary formats.
 |      The null option sets the textual representation of NULL in the input.
 |
 |      The size option sets the size of the buffer used when reading data
 |      from file-like objects.
 |
 |      The copy operation can be restricted to a subset of columns. If no
 |      columns are specified, all of them will be copied.
 |
 |  copy_to(self, stream, table, format=None, sep=None, null=None, decode=None, columns=None)
 |      Copy data from the specified table to an output stream.
 |
 |      The output stream can be a file-like object with a write() method or
 |      it can also be None, in which case the method will return a generator
 |      yielding a row on each iteration.
 |
 |      Output will be returned as byte strings unless you set decode to true.
 |
 |      Note that you can also use a select query instead of the table name.
 |
 |      The format must be text, csv or binary. The sep option sets the
 |      column separator (delimiter) used in the non binary formats.
 |      The null option sets the textual representation of NULL in the output.
 |
 |      The copy operation can be restricted to a subset of columns. If no
 |      columns are specified, all of them will be copied.
 |
 |  execute(self, operation, parameters=None)
 |      Prepare and execute a database operation (query or command).
 |
 |  executemany(self, operation, seq_of_parameters)
 |      Prepare operation and execute it against a parameter sequence.
 |
 |  fetchall(self)
 |      Fetch all (remaining) rows of a query result.
 |
 |  fetchmany(self, size=None, keep=False)
 |      Fetch the next set of rows of a query result.
 |
 |      The number of rows to fetch per call is specified by the
 |      size parameter. If it is not given, the cursor's arraysize
 |      determines the number of rows to be fetched. If you set
 |      the keep parameter to true, this is kept as new arraysize.
 |
 |  fetchone(self)
 |      Fetch the next row of a query result set.
 |
 |  next = __next__(self)
 |
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |
 |  nextset()
 |      Not supported.
 |
 |  row_factory(row)
 |      Process rows before they are returned.
 |
 |      You can overwrite this statically with a custom row factory, or
 |      you can build a row factory dynamically with build_row_factory().
 |
 |      For example, you can create a Cursor class that returns rows as
 |      Python dictionaries like this:
 |
 |          class DictCursor(pgdb.Cursor):
 |
 |              def row_factory(self, row):
 |                  return {desc[0]: value
 |                      for desc, value in zip(self.description, row)}
 |
 |          cur = DictCursor(con)  # get one DictCursor instance or
 |          con.cursor_type = DictCursor  # always use DictCursor instances
 |
 |  setinputsizes(sizes)
 |      Not supported.
 |
 |  setoutputsize(size, column=0)
 |      Not supported.
 |
 |  ----------------------------------------------------------------------
 |  Readonly properties defined here:
 |
 |  colnames
 |      Unofficial convenience method for getting the column names.
 |
 |  coltypes
 |      Unofficial convenience method for getting the column types.
 |
 |  description
 |      Read-only attribute describing the result columns.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables (if defined)
 |
 |  __weakref__
 |      list of weak references to the object (if defined)


Generated by phpMan Author: Che Dong Under GNU General Public License
2026-06-02 08:50 @216.73.216.198 CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 TransitionalValid CSS!

^_back to top