# pg - pydoc - phpman

> **TLDR:** View files one page at a time.
>
- View a file:
  `pg {{path/to/file}}`
- Display help:
  `pg {{-h|--help}}`

*Source: tldr-pages*

---

Help on module pg:

## NAME
    pg - PyGreSQL classic interface.

## DESCRIPTION
    This pg module implements some basic database management stuff.
    It includes the _pg module and builds on it, providing the higher
    level wrapper class named DB with additional functionality.
    This is known as the "classic" ("old style") PyGreSQL interface.
    For a DB-API 2 compliant interface use the newer pgdb module.

## CLASSES
    builtins.Exception(builtins.BaseException)
        Error
            DatabaseError
                DataError
                    InvalidResultError
                        MultipleResultsError
                        NoResultError
                IntegrityError
                InternalError
                NotSupportedError
                OperationalError
                ProgrammingError
            InterfaceError
        Warning
    builtins.bytes(builtins.object)
        Bytea
    builtins.dict(builtins.object)
        Hstore
        Typecasts
    builtins.object
        Adapter
        DB
        Json
        NotificationHandler
    builtins.str(builtins.object)
        Literal

### class Adapter
     |  Adapter(db)
     |
     |  Class providing methods for adapting parameters to the database.
     |
     |  Methods defined here:
     |
     |  __init__(self, db)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  adapt(self, value, typ=None)
     |      Adapt a value with known database type.
     |
     |  adapt_inline(self, value, nested=False)
     |      Adapt a value that is put into the SQL and needs to be quoted.
     |
     |  format_query(self, command, values=None, types=None, inline=False)
     |      Format a database query using the given values and types.
     |
     |  parameter_list(self)
     |      Return a parameter list for parameters with known database types.
     |
     |      The list has an add(value, typ) method that will build up the
     |      list and return either the literal value or a placeholder.
     |
     |  ----------------------------------------------------------------------
     |  Class methods defined here:
     |
     |  guess_simple_base_type(value) from builtins.type
     |      Try to guess the base type of a given array.
     |
     |  guess_simple_type(value) from builtins.type
     |      Try to guess which database type the given value has.
     |
     |  ----------------------------------------------------------------------
     |  Static methods defined here:
     |
     |  get_attnames(typ)
     |      Get the attribute names of a composite database type.
     |
     |  get_simple_name(typ)
     |      Get the simple name of a database type.
     |
     |  [simple_type(name)](https://www.chedong.com/phpMan.php/man/simpletype/name/markdown)
     |      Create a simple database type with given attribute names.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)

### class Bytea
     |  Wrapper class for marking Bytea values.
     |
     |  Method resolution order:
     |      Bytea
     |      builtins.bytes
     |      builtins.object
     |
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.bytes:
     |
     |  __add__(self, value, /)
     |      Return self+value.
     |
     |  __contains__(self, key, /)
     |      Return key in self.
     |
     |  __eq__(self, value, /)
     |      Return self==value.
     |
     |  __ge__(self, value, /)
     |      Return self>=value.
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __getitem__(self, key, /)
     |      Return self[key].
     |
     |  __getnewargs__(...)
     |
     |  __gt__(self, value, /)
     |      Return self>value.
     |
     |  __hash__(self, /)
     |      Return hash(self).
     |
     |  __iter__(self, /)
     |      Implement iter(self).
     |
     |  __le__(self, value, /)
     |      Return self<=value.
     |
     |  __len__(self, /)
     |      Return len(self).
     |
     |  __lt__(self, value, /)
     |      Return self<value.
     |
     |  __mod__(self, value, /)
     |      Return self%value.
     |
     |  __mul__(self, value, /)
     |      Return self*value.
     |
     |  __ne__(self, value, /)
     |      Return self!=value.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __rmod__(self, value, /)
     |      Return value%self.
     |
     |  __rmul__(self, value, /)
     |      Return value*self.
     |
     |  __str__(self, /)
     |      Return str(self).
     |
     |  capitalize(...)
     |      B.capitalize() -> copy of B
     |
     |      Return a copy of B with only its first character capitalized (ASCII)
     |      and the rest lower-cased.
     |
     |  center(self, width, fillchar=b' ', /)
     |      Return a centered string of length width.
     |
     |      Padding is done using the specified fill character.
     |
     |  count(...)
     |      B.count(sub[, start[, end]]) -> int
     |
     |      Return the number of non-overlapping occurrences of subsection sub in
     |      bytes B[start:end].  Optional arguments start and end are interpreted
     |      as in slice notation.
     |
     |  decode(self, /, encoding='utf-8', errors='strict')
     |      Decode the bytes using the codec registered for encoding.
     |
     |      encoding
     |        The encoding with which to decode the bytes.
     |      errors
     |        The error handling scheme to use for the handling of decoding errors.
     |        The default is 'strict' meaning that decoding errors raise a
     |        UnicodeDecodeError. Other possible values are 'ignore' and 'replace'
     |        as well as any other name registered with codecs.register_error that
     |        can handle UnicodeDecodeErrors.
     |
     |  endswith(...)
     |      B.endswith(suffix[, start[, end]]) -> bool
     |
     |      Return True if B ends with the specified suffix, False otherwise.
     |      With optional start, test B beginning at that position.
     |      With optional end, stop comparing B at that position.
     |      suffix can also be a tuple of bytes to try.
     |
     |  expandtabs(self, /, tabsize=8)
     |      Return a copy where all tab characters are expanded using spaces.
     |
     |      If tabsize is not given, a tab size of 8 characters is assumed.
     |
     |  find(...)
     |      B.find(sub[, start[, end]]) -> int
     |
     |      Return the lowest index in B where subsection sub is found,
     |      such that sub is contained within B[start,end].  Optional
     |      arguments start and end are interpreted as in slice notation.
     |
     |      Return -1 on failure.
     |
     |  hex(...)
     |      Create a string of hexadecimal numbers from a bytes object.
     |
     |        sep
     |          An optional single character or byte to separate hex bytes.
     |        bytes_per_sep
     |          How many bytes between separators.  Positive values count from the
     |          right, negative values count from the left.
     |
     |      Example:
     |      >>> value = b'\xb9\x01\xef'
     |      >>> value.hex()
     |      'b901ef'
     |      >>> value.hex(':')
     |      'b9:01:ef'
     |      >>> value.hex(':', 2)
     |      'b9:01ef'
     |      >>> value.hex(':', -2)
     |      'b901:ef'
     |
     |  index(...)
     |      B.index(sub[, start[, end]]) -> int
     |
     |      Return the lowest index in B where subsection sub is found,
     |      such that sub is contained within B[start,end].  Optional
     |      arguments start and end are interpreted as in slice notation.
     |
     |      Raises ValueError when the subsection is not found.
     |
     |  isalnum(...)
     |      B.isalnum() -> bool
     |
     |      Return True if all characters in B are alphanumeric
     |      and there is at least one character in B, False otherwise.
     |
     |  isalpha(...)
     |      B.isalpha() -> bool
     |
     |      Return True if all characters in B are alphabetic
     |      and there is at least one character in B, False otherwise.
     |
     |  isascii(...)
     |      B.isascii() -> bool
     |
     |      Return True if B is empty or all characters in B are ASCII,
     |      False otherwise.
     |
     |  isdigit(...)
     |      B.isdigit() -> bool
     |
     |      Return True if all characters in B are digits
     |      and there is at least one character in B, False otherwise.
     |
     |  islower(...)
     |      B.islower() -> bool
     |
     |      Return True if all cased characters in B are lowercase and there is
     |      at least one cased character in B, False otherwise.
     |
     |  isspace(...)
     |      B.isspace() -> bool
     |
     |      Return True if all characters in B are whitespace
     |      and there is at least one character in B, False otherwise.
     |
     |  istitle(...)
     |      B.istitle() -> bool
     |
     |      Return True if B is a titlecased string and there is at least one
     |      character in B, i.e. uppercase characters may only follow uncased
     |      characters and lowercase characters only cased ones. Return False
     |      otherwise.
     |
     |  isupper(...)
     |      B.isupper() -> bool
     |
     |      Return True if all cased characters in B are uppercase and there is
     |      at least one cased character in B, False otherwise.
     |
     |  join(self, iterable_of_bytes, /)
     |      Concatenate any number of bytes objects.
     |
     |      The bytes whose method is called is inserted in between each pair.
     |
     |      The result is returned as a new bytes object.
     |
     |      Example: b'.'.join([b'ab', b'pq', b'rs']) -> b'ab.pq.rs'.
     |
     |  ljust(self, width, fillchar=b' ', /)
     |      Return a left-justified string of length width.
     |
     |      Padding is done using the specified fill character.
     |
     |  lower(...)
     |      B.lower() -> copy of B
     |
     |      Return a copy of B with all ASCII characters converted to lowercase.
     |
     |  lstrip(self, bytes=None, /)
     |      Strip leading bytes contained in the argument.
     |
     |      If the argument is omitted or None, strip leading  ASCII whitespace.
     |
     |  partition(self, sep, /)
     |      Partition the bytes into three parts using the given separator.
     |
     |      This will search for the separator sep in the bytes. If the separator is found,
     |      returns a 3-tuple containing the part before the separator, the separator
     |      itself, and the part after it.
     |
     |      If the separator is not found, returns a 3-tuple containing the original bytes
     |      object and two empty bytes objects.
     |
     |  removeprefix(self, prefix, /)
     |      Return a bytes object with the given prefix string removed if present.
     |
     |      If the bytes starts with the prefix string, return bytes[len(prefix):].
     |      Otherwise, return a copy of the original bytes.
     |
     |  removesuffix(self, suffix, /)
     |      Return a bytes object with the given suffix string removed if present.
     |
     |      If the bytes ends with the suffix string and that suffix is not empty,
     |      return bytes[:-len(prefix)].  Otherwise, return a copy of the original
     |      bytes.
     |
     |  replace(self, old, new, count=-1, /)
     |      Return a copy with all occurrences of substring old replaced by new.
     |
     |        count
     |          Maximum number of occurrences to replace.
     |          -1 (the default value) means replace all occurrences.
     |
     |      If the optional argument count is given, only the first count occurrences are
     |      replaced.
     |
     |  rfind(...)
     |      B.rfind(sub[, start[, end]]) -> int
     |
     |      Return the highest index in B where subsection sub is found,
     |      such that sub is contained within B[start,end].  Optional
     |      arguments start and end are interpreted as in slice notation.
     |
     |      Return -1 on failure.
     |
     |  rindex(...)
     |      B.rindex(sub[, start[, end]]) -> int
     |
     |      Return the highest index in B where subsection sub is found,
     |      such that sub is contained within B[start,end].  Optional
     |      arguments start and end are interpreted as in slice notation.
     |
     |      Raise ValueError when the subsection is not found.
     |
     |  rjust(self, width, fillchar=b' ', /)
     |      Return a right-justified string of length width.
     |
     |      Padding is done using the specified fill character.
     |
     |  rpartition(self, sep, /)
     |      Partition the bytes into three parts using the given separator.
     |
     |      This will search for the separator sep in the bytes, starting at the end. If
     |      the separator is found, returns a 3-tuple containing the part before the
     |      separator, the separator itself, and the part after it.
     |
     |      If the separator is not found, returns a 3-tuple containing two empty bytes
     |      objects and the original bytes object.
     |
     |  rsplit(self, /, sep=None, maxsplit=-1)
     |      Return a list of the sections in the bytes, using sep as the delimiter.
     |
     |        sep
     |          The delimiter according which to split the bytes.
     |          None (the default value) means split on ASCII whitespace characters
     |          (space, tab, return, newline, formfeed, vertical tab).
     |        maxsplit
     |          Maximum number of splits to do.
     |          -1 (the default value) means no limit.
     |
     |      Splitting is done starting at the end of the bytes and working to the front.
     |
     |  rstrip(self, bytes=None, /)
     |      Strip trailing bytes contained in the argument.
     |
     |      If the argument is omitted or None, strip trailing ASCII whitespace.
     |
     |  split(self, /, sep=None, maxsplit=-1)
     |      Return a list of the sections in the bytes, using sep as the delimiter.
     |
     |      sep
     |        The delimiter according which to split the bytes.
     |        None (the default value) means split on ASCII whitespace characters
     |        (space, tab, return, newline, formfeed, vertical tab).
     |      maxsplit
     |        Maximum number of splits to do.
     |        -1 (the default value) means no limit.
     |
     |  splitlines(self, /, keepends=False)
     |      Return a list of the lines in the bytes, breaking at line boundaries.
     |
     |      Line breaks are not included in the resulting list unless keepends is given and
     |      true.
     |
     |  startswith(...)
     |      B.startswith(prefix[, start[, end]]) -> bool
     |
     |      Return True if B starts with the specified prefix, False otherwise.
     |      With optional start, test B beginning at that position.
     |      With optional end, stop comparing B at that position.
     |      prefix can also be a tuple of bytes to try.
     |
     |  strip(self, bytes=None, /)
     |      Strip leading and trailing bytes contained in the argument.
     |
     |      If the argument is omitted or None, strip leading and trailing ASCII whitespace.
     |
     |  swapcase(...)
     |      B.swapcase() -> copy of B
     |
     |      Return a copy of B with uppercase ASCII characters converted
     |      to lowercase ASCII and vice versa.
     |
     |  title(...)
     |      B.title() -> copy of B
     |
     |      Return a titlecased version of B, i.e. ASCII words start with uppercase
     |      characters, all remaining cased characters have lowercase.
     |
     |  translate(self, table, /, delete=b'')
     |      Return a copy with each character mapped by the given translation table.
     |
     |        table
     |          Translation table, which must be a bytes object of length 256.
     |
     |      All characters occurring in the optional argument delete are removed.
     |      The remaining characters are mapped through the given translation table.
     |
     |  upper(...)
     |      B.upper() -> copy of B
     |
     |      Return a copy of B with all ASCII characters converted to uppercase.
     |
     |  zfill(self, width, /)
     |      Pad a numeric string with zeros on the left, to fill a field of the given width.
     |
     |      The original string is never truncated.
     |
     |  ----------------------------------------------------------------------
     |  Class methods inherited from builtins.bytes:
     |
     |  fromhex(string, /) from builtins.type
     |      Create a bytes object from a string of hexadecimal numbers.
     |
     |      Spaces between two numbers are accepted.
     |      Example: bytes.fromhex('B9 01EF') -> b'\\xb9\\x01\\xef'.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.bytes:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  maketrans(frm, to, /)
     |      Return a translation table useable for the bytes or bytearray translate method.
     |
     |      The returned table will be one where each byte in frm is mapped to the byte at
     |      the same position in to.
     |
     |      The bytes objects frm and to must be of the same length.

### class DB
     |  DB(*args, **kw)
     |
     |  Wrapper class for the _pg connection type.
     |
     |  Methods defined here:
     |
     |  __del__(self)
     |
     |  __dir__(self)
     |      Default dir() implementation.
     |
     |  __enter__(self)
     |      Enter the runtime context. This will start a transaction.
     |
     |  __exit__(self, et, ev, tb)
     |      Exit the runtime context. This will end the transaction.
     |
     |  __getattr__(self, name)
     |
     |  __init__(self, *args, **kw)
     |      Create a new connection
     |
     |      You can pass either the connection parameters or an existing
     |      _pg or pgdb connection. This allows you to use the methods
     |      of the classic pg interface with a DB-API 2 pgdb connection.
     |
     |  abort = rollback(self, name=None)
     |
     |  begin(self, mode=None)
     |      Begin a transaction.
     |
     |  clear(self, table, row=None)
     |      Clear all the attributes to values determined by the types.
     |
     |      Numeric types are set to 0, Booleans are set to false, and everything
     |      else is set to the empty string.  If the row argument is present,
     |      it is used as the row dictionary and any entries matching attribute
     |      names are cleared with everything else left unchanged.
     |
     |  close(self)
     |      Close the database connection.
     |
     |  commit(self)
     |      Commit the current transaction.
     |
     |  decode_json(self, s)
     |      Decode a JSON string coming from the database.
     |
     |  delete(self, table, row=None, **kw)
     |      Delete an existing row in a database table.
     |
     |      This method deletes the row from a table.  It deletes based on the
     |      primary key of the table or the OID value as munged by get() or
     |      passed as keyword.  The OID will take precedence if provided.
     |
     |      The return value is the number of deleted rows (i.e. 0 if the row
     |      did not exist and 1 if the row was deleted).
     |
     |      Note that if the row cannot be deleted because e.g. it is still
     |      referenced by another table, this method raises a ProgrammingError.
     |
     |  delete_prepared(self, name=None)
     |      Delete a prepared SQL statement
     |
     |      This deallocates a previously prepared SQL statement with the given
     |      name, or deallocates all prepared statements if you do not specify a
     |      name. Note that prepared statements are also deallocated automatically
     |      when the current session ends.
     |
     |  describe_prepared(self, name=None)
     |      Describe a prepared SQL statement.
     |
     |      This method returns a Query object describing the result columns of
     |      the prepared statement with the given name. If you omit the name,
     |      the unnamed statement will be described if you created one before.
     |
     |  encode_json(self, d)
     |      Encode a JSON string for use within SQL.
     |
     |  end = commit(self)
     |
     |  get(self, table, row, keyname=None)
     |      Get a row from a database table or view.
     |
     |      This method is the basic mechanism to get a single row.  It assumes
     |      that the keyname specifies a unique row.  It must be the name of a
     |      single column or a tuple of column names.  If the keyname is not
     |      specified, then the primary key for the table is used.
     |
     |      If row is a dictionary, then the value for the key is taken from it.
     |      Otherwise, the row must be a single value or a tuple of values
     |      corresponding to the passed keyname or primary key.  The fetched row
     |      from the table will be returned as a new dictionary or used to replace
     |      the existing values when row was passed as a dictionary.
     |
     |      The OID is also put into the dictionary if the table has one, but
     |      in order to allow the caller to work with multiple tables, it is
     |      munged as "oid(table)" using the actual name of the table.
     |
     |  get_as_dict(self, table, keyname=None, what=None, where=None, order=None, limit=None, offset=None, scalar=False)
     |      Get a table as a dictionary.
     |
     |      This method is similar to get_as_list(), but returns the table
     |      as a Python dict instead of a Python list, which can be even
     |      more convenient. The primary key column(s) of the table will
     |      be used as the keys of the dictionary, while the other column(s)
     |      will be the corresponding values.  The keys will be named tuples
     |      if the table has a composite primary key.  The rows will be also
     |      named tuples unless the 'scalar' option has been set to True.
     |      With the optional parameter 'keyname' you can specify an alternative
     |      set of columns to be used as the keys of the dictionary.  It must
     |      be set as a string, list or a tuple.
     |
     |      If the Python version supports it, the dictionary will be an
     |      OrderedDict using the order specified with the 'order' parameter
     |      or the key column(s) if not specified.  You can set 'order' to False
     |      if you don't care about the ordering.  In this case the returned
     |      dictionary will be an ordinary one.
     |
     |  get_as_list(self, table, what=None, where=None, order=None, limit=None, offset=None, scalar=False)
     |      Get a table as a list.
     |
     |      This gets a convenient representation of the table as a list
     |      of named tuples in Python.  You only need to pass the name of
     |      the table (or any other SQL expression returning rows).  Note that
     |      by default this will return the full content of the table which
     |      can be huge and overflow your memory.  However, you can control
     |      the amount of data returned using the other optional parameters.
     |
     |      The parameter 'what' can restrict the query to only return a
     |      subset of the table columns.  It can be a string, list or a tuple.
     |      The parameter 'where' can restrict the query to only return a
     |      subset of the table rows.  It can be a string, list or a tuple
     |      of SQL expressions that all need to be fulfilled.  The parameter
     |      'order' specifies the ordering of the rows.  It can also be a
     |      other string, list or a tuple.  If no ordering is specified,
     |      the result will be ordered by the primary key(s) or all columns
     |      if no primary key exists.  You can set 'order' to False if you
     |      don't care about the ordering.  The parameters 'limit' and 'offset'
     |      can be integers specifying the maximum number of rows returned
     |      and a number of rows skipped over.
     |
     |      If you set the 'scalar' option to True, then instead of the
     |      named tuples you will get the first items of these tuples.
     |      This is useful if the result has only one column anyway.
     |
     |  get_attnames(self, table, with_oid=True, flush=False)
     |      Given the name of a table, dig out the set of attribute names.
     |
     |      Returns a read-only dictionary of attribute names (the names are
     |      the keys, the values are the names of the attributes' types)
     |      with the column names in the proper order if you iterate over it.
     |
     |      If flush is set, then the internal cache for attribute names will
     |      be flushed. This may be necessary after the database schema or
     |      the search path has been changed.
     |
     |      By default, only a limited number of simple types will be returned.
     |      You can get the registered types after calling use_regtypes(True).
     |
     |  get_databases(self)
     |      Get list of databases in the system.
     |
     |  get_parameter(self, parameter)
     |      Get the value of a run-time parameter.
     |
     |      If the parameter is a string, the return value will also be a string
     |      that is the current setting of the run-time parameter with that name.
     |
     |      You can get several parameters at once by passing a list, set or dict.
     |      When passing a list of parameter names, the return value will be a
     |      corresponding list of parameter settings.  When passing a set of
     |      parameter names, a new dict will be returned, mapping these parameter
     |      names to their settings.  Finally, if you pass a dict as parameter,
     |      its values will be set to the current parameter settings corresponding
     |      to its keys.
     |
     |      By passing the special name 'all' as the parameter, you can get a dict
     |      of all existing configuration parameters.
     |
     |  get_relations(self, kinds=None, system=False)
     |      Get list of relations in connected database of specified kinds.
     |
     |      If kinds is None or empty, all kinds of relations are returned.
     |      Otherwise kinds can be a string or sequence of type letters
     |      specifying which kind of relations you want to list.
     |
     |      Set the system flag if you want to get the system relations as well.
     |
     |  get_tables(self, system=False)
     |      Return list of tables in connected database.
     |
     |      Set the system flag if you want to get the system tables as well.
     |
     |  has_table_privilege(self, table, privilege='select', flush=False)
     |      Check whether current user has specified table privilege.
     |
     |      If flush is set, then the internal cache for table privileges will
     |      be flushed. This may be necessary after privileges have been changed.
     |
     |  insert(self, table, row=None, **kw)
     |      Insert a row into a database table.
     |
     |      This method inserts a row into a table.  The name of the table must
     |      be passed as the first parameter.  The other parameters are used for
     |      providing the data of the row that shall be inserted into the table.
     |      If a dictionary is supplied as the second parameter, it starts with
     |      that.  Otherwise it uses a blank dictionary. Either way the dictionary
     |      is updated from the keywords.
     |
     |      The dictionary is then reloaded with the values actually inserted in
     |      order to pick up values modified by rules, triggers, etc.
     |
     |  notification_handler(self, event, callback, arg_dict=None, timeout=None, stop_event=None)
     |      Get notification handler that will run the given callback.
     |
     |  pkey(self, table, composite=False, flush=False)
     |      Get or set the primary key of a table.
     |
     |      Single primary keys are returned as strings unless you
     |      set the composite flag.  Composite primary keys are always
     |      represented as tuples.  Note that this raises a KeyError
     |      if the table does not have a primary key.
     |
     |      If flush is set then the internal cache for primary keys will
     |      be flushed.  This may be necessary after the database schema or
     |      the search path has been changed.
     |
     |  prepare(self, name, command)
     |      Create a prepared SQL statement.
     |
     |      This creates a prepared statement for the given command with the
     |      given name for later execution with the query_prepared() method.
     |
     |      The name can be empty to create an unnamed statement, in which case
     |      any pre-existing unnamed statement is automatically replaced;
     |      otherwise it is an error if the statement name is already
     |      defined in the current database session. We recommend always using
     |      named queries, since unnamed queries have a limited lifetime and
     |      can be automatically replaced or destroyed by various operations.
     |
     |  query(self, command, *args)
     |      Execute a SQL command string.
     |
     |      This method simply sends a SQL query to the database.  If the query is
     |      an insert statement that inserted exactly one row into a table that
     |      has OIDs, the return value is the OID of the newly inserted row.
     |      If the query is an update or delete statement, or an insert statement
     |      that did not insert exactly one row in a table with OIDs, then the
     |      number of rows affected is returned as a string.  If it is a statement
     |      that returns rows as a result (usually a select statement, but maybe
     |      also an "insert/update ... returning" statement), this method returns
     |      a Query object that can be accessed via getresult() or dictresult()
     |      or simply printed.  Otherwise, it returns `None`.
     |
     |      The query can contain numbered parameters of the form $1 in place
     |      of any data constant.  Arguments given after the query string will
     |      be substituted for the corresponding numbered parameter.  Parameter
     |      values can also be given as a single list or tuple argument.
     |
     |  query_formatted(self, command, parameters=None, types=None, inline=False)
     |      Execute a formatted SQL command string.
     |
     |      Similar to query, but using Python format placeholders of the form
     |      %s or %(names)s instead of PostgreSQL placeholders of the form $1.
     |      The parameters must be passed as a tuple, list or dict.  You can
     |      also pass a corresponding tuple, list or dict of database types in
     |      order to format the parameters properly in case there is ambiguity.
     |
     |      If you set inline to True, the parameters will be sent to the database
     |      embedded in the SQL command, otherwise they will be sent separately.
     |
     |  query_prepared(self, name, *args)
     |      Execute a prepared SQL statement.
     |
     |      This works like the query() method, except that instead of passing
     |      the SQL command, you pass the name of a prepared statement.  If you
     |      pass an empty name, the unnamed statement will be executed.
     |
     |  release(self, name)
     |      Destroy a previously defined savepoint.
     |
     |  reopen(self)
     |      Reopen connection to the database.
     |
     |      Used in case we need another connection to the same database.
     |      Note that we can still reopen a database that we have closed.
     |
     |  reset(self)
     |      Reset connection with current parameters.
     |
     |      All derived queries and large objects derived from this connection
     |      will not be usable after this call.
     |
     |  rollback(self, name=None)
     |      Roll back the current transaction.
     |
     |  savepoint(self, name)
     |      Define a new savepoint within the current transaction.
     |
     |  set_parameter(self, parameter, value=None, local=False)
     |      Set the value of a run-time parameter.
     |
     |      If the parameter and the value are strings, the run-time parameter
     |      will be set to that value.  If no value or None is passed as a value,
     |      then the run-time parameter will be restored to its default value.
     |
     |      You can set several parameters at once by passing a list of parameter
     |      names, together with a single value that all parameters should be
     |      set to or with a corresponding list of values.  You can also pass
     |      the parameters as a set if you only provide a single value.
     |      Finally, you can pass a dict with parameter names as keys.  In this
     |      case, you should not pass a value, since the values for the parameters
     |      will be taken from the dict.
     |
     |      By passing the special name 'all' as the parameter, you can reset
     |      all existing settable run-time parameters to their default values.
     |
     |      If you set local to True, then the command takes effect for only the
     |      current transaction.  After commit() or rollback(), the session-level
     |      setting takes effect again.  Setting local to True will appear to
     |      have no effect if it is executed outside a transaction, since the
     |      transaction will end immediately.
     |
     |  start = begin(self, mode=None)
     |
     |  truncate(self, table, restart=False, cascade=False, only=False)
     |      Empty a table or set of tables.
     |
     |      This method quickly removes all rows from the given table or set
     |      of tables.  It has the same effect as an unqualified DELETE on each
     |      table, but since it does not actually scan the tables it is faster.
     |      Furthermore, it reclaims disk space immediately, rather than requiring
     |      a subsequent VACUUM operation. This is most useful on large tables.
     |
     |      If restart is set to True, sequences owned by columns of the truncated
     |      table(s) are automatically restarted.  If cascade is set to True, it
     |      also truncates all tables that have foreign-key references to any of
     |      the named tables.  If the parameter only is not set to True, all the
     |      descendant tables (if any) will also be truncated. Optionally, a '*'
     |      can be specified after the table name to explicitly indicate that
     |      descendant tables are included.
     |
     |  update(self, table, row=None, **kw)
     |      Update an existing row in a database table.
     |
     |      Similar to insert, but updates an existing row.  The update is based
     |      on the primary key of the table or the OID value as munged by get()
     |      or passed as keyword.  The OID will take precedence if provided, so
     |      that it is possible to update the primary key itself.
     |
     |      The dictionary is then modified to reflect any changes caused by the
     |      update due to triggers, rules, default values, etc.
     |
     |  upsert(self, table, row=None, **kw)
     |      Insert a row into a database table with conflict resolution
     |
     |      This method inserts a row into a table, but instead of raising a
     |      ProgrammingError exception in case a row with the same primary key
     |      already exists, an update will be executed instead.  This will be
     |      performed as a single atomic operation on the database, so race
     |      conditions can be avoided.
     |
     |      Like the insert method, the first parameter is the name of the
     |      table and the second parameter can be used to pass the values to
     |      be inserted as a dictionary.
     |
     |      Unlike the insert und update statement, keyword parameters are not
     |      used to modify the dictionary, but to specify which columns shall
     |      be updated in case of a conflict, and in which way:
     |
     |      A value of False or None means the column shall not be updated,
     |      a value of True means the column shall be updated with the value
     |      that has been proposed for insertion, i.e. has been passed as value
     |      in the dictionary.  Columns that are not specified by keywords but
     |      appear as keys in the dictionary are also updated like in the case
     |      keywords had been passed with the value True.
     |
     |      So if in the case of a conflict you want to update every column that
     |      has been passed in the dictionary row, you would call upsert(table, row).
     |      If you don't want to do anything in case of a conflict, i.e. leave
     |      the existing row as it is, call upsert(table, row, **dict.fromkeys(row)).
     |
     |      If you need more fine-grained control of what gets updated, you can
     |      also pass strings in the keyword parameters.  These strings will
     |      be used as SQL expressions for the update columns.  In these
     |      expressions you can refer to the value that already exists in
     |      the table by prefixing the column name with "included.", and to
     |      the value that has been proposed for insertion by prefixing the
     |      column name with the "excluded."
     |
     |      The dictionary is modified in any case to reflect the values in
     |      the database after the operation has completed.
     |
     |      Note: The method uses the PostgreSQL "upsert" feature which is
     |      only available since PostgreSQL 9.5.
     |
     |  use_regtypes(self, regtypes=None)
     |      Use registered type names instead of simplified type names.
     |
     |  ----------------------------------------------------------------------
     |  Static methods defined here:
     |
     |  unescape_bytea(...)
     |      unescape_bytea(string) -- unescape bytea data retrieved as text
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |
     |  db = None

### class DataError
     |  Method resolution order:
     |      DataError
     |      DatabaseError
     |      Error
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Data descriptors inherited from Error:
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.Exception:
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  __str__(self, /)
     |      Return str(self).
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

### class DatabaseError
     |  Method resolution order:
     |      DatabaseError
     |      Error
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Data descriptors inherited from Error:
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.Exception:
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  __str__(self, /)
     |      Return str(self).
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

### class Error
     |  Method resolution order:
     |      Error
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Data descriptors defined here:
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.Exception:
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  __str__(self, /)
     |      Return str(self).
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

### class Hstore
     |  Wrapper class for marking hstore values.
     |
     |  Method resolution order:
     |      Hstore
     |      builtins.dict
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  __str__(self)
     |      Return str(self).
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.dict:
     |
     |  __contains__(self, key, /)
     |      True if the dictionary has the specified key, else False.
     |
     |  __delitem__(self, key, /)
     |      Delete self[key].
     |
     |  __eq__(self, value, /)
     |      Return self==value.
     |
     |  __ge__(self, value, /)
     |      Return self>=value.
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __getitem__(...)
     |      x.__getitem__(y) <==> x[y]
     |
     |  __gt__(self, value, /)
     |      Return self>value.
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  __ior__(self, value, /)
     |      Return self|=value.
     |
     |  __iter__(self, /)
     |      Implement iter(self).
     |
     |  __le__(self, value, /)
     |      Return self<=value.
     |
     |  __len__(self, /)
     |      Return len(self).
     |
     |  __lt__(self, value, /)
     |      Return self<value.
     |
     |  __ne__(self, value, /)
     |      Return self!=value.
     |
     |  __or__(self, value, /)
     |      Return self|value.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __reversed__(self, /)
     |      Return a reverse iterator over the dict keys.
     |
     |  __ror__(self, value, /)
     |      Return value|self.
     |
     |  __setitem__(self, key, value, /)
     |      Set self[key] to value.
     |
     |  __sizeof__(...)
     |      D.__sizeof__() -> size of D in memory, in bytes
     |
     |  clear(...)
     |      D.clear() -> None.  Remove all items from D.
     |
     |  copy(...)
     |      D.copy() -> a shallow copy of D
     |
     |  get(self, key, default=None, /)
     |      Return the value for key if key is in the dictionary, else default.
     |
     |  items(...)
     |      D.items() -> a set-like object providing a view on D's items
     |
     |  keys(...)
     |      D.keys() -> a set-like object providing a view on D's keys
     |
     |  pop(...)
     |      D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
     |
     |      If the key is not found, return the default if given; otherwise,
     |      raise a KeyError.
     |
     |  popitem(self, /)
     |      Remove and return a (key, value) pair as a 2-tuple.
     |
     |      Pairs are returned in LIFO (last-in, first-out) order.
     |      Raises KeyError if the dict is empty.
     |
     |  setdefault(self, key, default=None, /)
     |      Insert key with a value of default if key is not in the dictionary.
     |
     |      Return the value for key if key is in the dictionary, else default.
     |
     |  update(...)
     |      D.update([E, ]**F) -> None.  Update D from dict/iterable E and F.
     |      If E is present and has a .keys() method, then does:  for k in E: D[k] = E[k]
     |      If E is present and lacks a .keys() method, then does:  for k, v in E: D[k] = v
     |      In either case, this is followed by: for k in F:  D[k] = F[k]
     |
     |  values(...)
     |      D.values() -> an object providing a view on D's values
     |
     |  ----------------------------------------------------------------------
     |  Class methods inherited from builtins.dict:
     |
     |  __class_getitem__(...) from builtins.type
     |      See PEP 585
     |
     |  fromkeys(iterable, value=None, /) from builtins.type
     |      Create a new dictionary with keys from iterable and values set to value.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.dict:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes inherited from builtins.dict:
     |
     |  __hash__ = None

### class IntegrityError
     |  Method resolution order:
     |      IntegrityError
     |      DatabaseError
     |      Error
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Data descriptors inherited from Error:
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.Exception:
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  __str__(self, /)
     |      Return str(self).
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

### class InterfaceError
     |  Method resolution order:
     |      InterfaceError
     |      Error
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Data descriptors inherited from Error:
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.Exception:
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  __str__(self, /)
     |      Return str(self).
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

### class InternalError
     |  Method resolution order:
     |      InternalError
     |      DatabaseError
     |      Error
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Data descriptors inherited from Error:
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.Exception:
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  __str__(self, /)
     |      Return str(self).
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

### class InvalidResultError
     |  Method resolution order:
     |      InvalidResultError
     |      DataError
     |      DatabaseError
     |      Error
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Data descriptors inherited from Error:
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.Exception:
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  __str__(self, /)
     |      Return str(self).
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

### class Json
     |  Json(obj)
     |
     |  Wrapper class for marking Json values.
     |
     |  Methods defined here:
     |
     |  __init__(self, obj)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)

### class Literal
     |  Wrapper class for marking literal SQL values.
     |
     |  Method resolution order:
     |      Literal
     |      builtins.str
     |      builtins.object
     |
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.str:
     |
     |  __add__(self, value, /)
     |      Return self+value.
     |
     |  __contains__(self, key, /)
     |      Return key in self.
     |
     |  __eq__(self, value, /)
     |      Return self==value.
     |
     |  __format__(self, format_spec, /)
     |      Return a formatted version of the string as described by format_spec.
     |
     |  __ge__(self, value, /)
     |      Return self>=value.
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __getitem__(self, key, /)
     |      Return self[key].
     |
     |  __getnewargs__(...)
     |
     |  __gt__(self, value, /)
     |      Return self>value.
     |
     |  __hash__(self, /)
     |      Return hash(self).
     |
     |  __iter__(self, /)
     |      Implement iter(self).
     |
     |  __le__(self, value, /)
     |      Return self<=value.
     |
     |  __len__(self, /)
     |      Return len(self).
     |
     |  __lt__(self, value, /)
     |      Return self<value.
     |
     |  __mod__(self, value, /)
     |      Return self%value.
     |
     |  __mul__(self, value, /)
     |      Return self*value.
     |
     |  __ne__(self, value, /)
     |      Return self!=value.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __rmod__(self, value, /)
     |      Return value%self.
     |
     |  __rmul__(self, value, /)
     |      Return value*self.
     |
     |  __sizeof__(self, /)
     |      Return the size of the string in memory, in bytes.
     |
     |  __str__(self, /)
     |      Return str(self).
     |
     |  capitalize(self, /)
     |      Return a capitalized version of the string.
     |
     |      More specifically, make the first character have upper case and the rest lower
     |      case.
     |
     |  casefold(self, /)
     |      Return a version of the string suitable for caseless comparisons.
     |
     |  center(self, width, fillchar=' ', /)
     |      Return a centered string of length width.
     |
     |      Padding is done using the specified fill character (default is a space).
     |
     |  count(...)
     |      S.count(sub[, start[, end]]) -> int
     |
     |      Return the number of non-overlapping occurrences of substring sub in
     |      string S[start:end].  Optional arguments start and end are
     |      interpreted as in slice notation.
     |
     |  encode(self, /, encoding='utf-8', errors='strict')
     |      Encode the string using the codec registered for encoding.
     |
     |      encoding
     |        The encoding in which to encode the string.
     |      errors
     |        The error handling scheme to use for encoding errors.
     |        The default is 'strict' meaning that encoding errors raise a
     |        UnicodeEncodeError.  Other possible values are 'ignore', 'replace' and
     |        'xmlcharrefreplace' as well as any other name registered with
     |        codecs.register_error that can handle UnicodeEncodeErrors.
     |
     |  endswith(...)
     |      S.endswith(suffix[, start[, end]]) -> bool
     |
     |      Return True if S ends with the specified suffix, False otherwise.
     |      With optional start, test S beginning at that position.
     |      With optional end, stop comparing S at that position.
     |      suffix can also be a tuple of strings to try.
     |
     |  expandtabs(self, /, tabsize=8)
     |      Return a copy where all tab characters are expanded using spaces.
     |
     |      If tabsize is not given, a tab size of 8 characters is assumed.
     |
     |  find(...)
     |      S.find(sub[, start[, end]]) -> int
     |
     |      Return the lowest index in S where substring sub is found,
     |      such that sub is contained within S[start:end].  Optional
     |      arguments start and end are interpreted as in slice notation.
     |
     |      Return -1 on failure.
     |
     |  format(...)
     |      S.format(*args, **kwargs) -> str
     |
     |      Return a formatted version of S, using substitutions from args and kwargs.
     |      The substitutions are identified by braces ('{' and '}').
     |
     |  format_map(...)
     |      S.format_map(mapping) -> str
     |
     |      Return a formatted version of S, using substitutions from mapping.
     |      The substitutions are identified by braces ('{' and '}').
     |
     |  index(...)
     |      S.index(sub[, start[, end]]) -> int
     |
     |      Return the lowest index in S where substring sub is found,
     |      such that sub is contained within S[start:end].  Optional
     |      arguments start and end are interpreted as in slice notation.
     |
     |      Raises ValueError when the substring is not found.
     |
     |  isalnum(self, /)
     |      Return True if the string is an alpha-numeric string, False otherwise.
     |
     |      A string is alpha-numeric if all characters in the string are alpha-numeric and
     |      there is at least one character in the string.
     |
     |  isalpha(self, /)
     |      Return True if the string is an alphabetic string, False otherwise.
     |
     |      A string is alphabetic if all characters in the string are alphabetic and there
     |      is at least one character in the string.
     |
     |  isascii(self, /)
     |      Return True if all characters in the string are ASCII, False otherwise.
     |
     |      ASCII characters have code points in the range U+0000-U+007F.
     |      Empty string is ASCII too.
     |
     |  isdecimal(self, /)
     |      Return True if the string is a decimal string, False otherwise.
     |
     |      A string is a decimal string if all characters in the string are decimal and
     |      there is at least one character in the string.
     |
     |  isdigit(self, /)
     |      Return True if the string is a digit string, False otherwise.
     |
     |      A string is a digit string if all characters in the string are digits and there
     |      is at least one character in the string.
     |
     |  isidentifier(self, /)
     |      Return True if the string is a valid Python identifier, False otherwise.
     |
     |      Call keyword.iskeyword(s) to test whether string s is a reserved identifier,
     |      such as "def" or "class".
     |
     |  islower(self, /)
     |      Return True if the string is a lowercase string, False otherwise.
     |
     |      A string is lowercase if all cased characters in the string are lowercase and
     |      there is at least one cased character in the string.
     |
     |  isnumeric(self, /)
     |      Return True if the string is a numeric string, False otherwise.
     |
     |      A string is numeric if all characters in the string are numeric and there is at
     |      least one character in the string.
     |
     |  isprintable(self, /)
     |      Return True if the string is printable, False otherwise.
     |
     |      A string is printable if all of its characters are considered printable in
     |      repr() or if it is empty.
     |
     |  isspace(self, /)
     |      Return True if the string is a whitespace string, False otherwise.
     |
     |      A string is whitespace if all characters in the string are whitespace and there
     |      is at least one character in the string.
     |
     |  istitle(self, /)
     |      Return True if the string is a title-cased string, False otherwise.
     |
     |      In a title-cased string, upper- and title-case characters may only
     |      follow uncased characters and lowercase characters only cased ones.
     |
     |  isupper(self, /)
     |      Return True if the string is an uppercase string, False otherwise.
     |
     |      A string is uppercase if all cased characters in the string are uppercase and
     |      there is at least one cased character in the string.
     |
     |  join(self, iterable, /)
     |      Concatenate any number of strings.
     |
     |      The string whose method is called is inserted in between each given string.
     |      The result is returned as a new string.
     |
     |      Example: '.'.join(['ab', 'pq', 'rs']) -> 'ab.pq.rs'
     |
     |  ljust(self, width, fillchar=' ', /)
     |      Return a left-justified string of length width.
     |
     |      Padding is done using the specified fill character (default is a space).
     |
     |  lower(self, /)
     |      Return a copy of the string converted to lowercase.
     |
     |  lstrip(self, chars=None, /)
     |      Return a copy of the string with leading whitespace removed.
     |
     |      If chars is given and not None, remove characters in chars instead.
     |
     |  partition(self, sep, /)
     |      Partition the string into three parts using the given separator.
     |
     |      This will search for the separator in the string.  If the separator is found,
     |      returns a 3-tuple containing the part before the separator, the separator
     |      itself, and the part after it.
     |
     |      If the separator is not found, returns a 3-tuple containing the original string
     |      and two empty strings.
     |
     |  removeprefix(self, prefix, /)
     |      Return a str with the given prefix string removed if present.
     |
     |      If the string starts with the prefix string, return string[len(prefix):].
     |      Otherwise, return a copy of the original string.
     |
     |  removesuffix(self, suffix, /)
     |      Return a str with the given suffix string removed if present.
     |
     |      If the string ends with the suffix string and that suffix is not empty,
     |      return string[:-len(suffix)]. Otherwise, return a copy of the original
     |      string.
     |
     |  replace(self, old, new, count=-1, /)
     |      Return a copy with all occurrences of substring old replaced by new.
     |
     |        count
     |          Maximum number of occurrences to replace.
     |          -1 (the default value) means replace all occurrences.
     |
     |      If the optional argument count is given, only the first count occurrences are
     |      replaced.
     |
     |  rfind(...)
     |      S.rfind(sub[, start[, end]]) -> int
     |
     |      Return the highest index in S where substring sub is found,
     |      such that sub is contained within S[start:end].  Optional
     |      arguments start and end are interpreted as in slice notation.
     |
     |      Return -1 on failure.
     |
     |  rindex(...)
     |      S.rindex(sub[, start[, end]]) -> int
     |
     |      Return the highest index in S where substring sub is found,
     |      such that sub is contained within S[start:end].  Optional
     |      arguments start and end are interpreted as in slice notation.
     |
     |      Raises ValueError when the substring is not found.
     |
     |  rjust(self, width, fillchar=' ', /)
     |      Return a right-justified string of length width.
     |
     |      Padding is done using the specified fill character (default is a space).
     |
     |  rpartition(self, sep, /)
     |      Partition the string into three parts using the given separator.
     |
     |      This will search for the separator in the string, starting at the end. If
     |      the separator is found, returns a 3-tuple containing the part before the
     |      separator, the separator itself, and the part after it.
     |
     |      If the separator is not found, returns a 3-tuple containing two empty strings
     |      and the original string.
     |
     |  rsplit(self, /, sep=None, maxsplit=-1)
     |      Return a list of the substrings in the string, using sep as the separator string.
     |
     |        sep
     |          The separator used to split the string.
     |
     |          When set to None (the default value), will split on any whitespace
     |          character (including \\n \\r \\t \\f and spaces) and will discard
     |          empty strings from the result.
     |        maxsplit
     |          Maximum number of splits (starting from the left).
     |          -1 (the default value) means no limit.
     |
     |      Splitting starts at the end of the string and works to the front.
     |
     |  rstrip(self, chars=None, /)
     |      Return a copy of the string with trailing whitespace removed.
     |
     |      If chars is given and not None, remove characters in chars instead.
     |
     |  split(self, /, sep=None, maxsplit=-1)
     |      Return a list of the substrings in the string, using sep as the separator string.
     |
     |        sep
     |          The separator used to split the string.
     |
     |          When set to None (the default value), will split on any whitespace
     |          character (including \\n \\r \\t \\f and spaces) and will discard
     |          empty strings from the result.
     |        maxsplit
     |          Maximum number of splits (starting from the left).
     |          -1 (the default value) means no limit.
     |
     |      Note, str.split() is mainly useful for data that has been intentionally
     |      delimited.  With natural text that includes punctuation, consider using
     |      the regular expression module.
     |
     |  splitlines(self, /, keepends=False)
     |      Return a list of the lines in the string, breaking at line boundaries.
     |
     |      Line breaks are not included in the resulting list unless keepends is given and
     |      true.
     |
     |  startswith(...)
     |      S.startswith(prefix[, start[, end]]) -> bool
     |
     |      Return True if S starts with the specified prefix, False otherwise.
     |      With optional start, test S beginning at that position.
     |      With optional end, stop comparing S at that position.
     |      prefix can also be a tuple of strings to try.
     |
     |  strip(self, chars=None, /)
     |      Return a copy of the string with leading and trailing whitespace removed.
     |
     |      If chars is given and not None, remove characters in chars instead.
     |
     |  swapcase(self, /)
     |      Convert uppercase characters to lowercase and lowercase characters to uppercase.
     |
     |  title(self, /)
     |      Return a version of the string where each word is titlecased.
     |
     |      More specifically, words start with uppercased characters and all remaining
     |      cased characters have lower case.
     |
     |  translate(self, table, /)
     |      Replace each character in the string using the given translation table.
     |
     |        table
     |          Translation table, which must be a mapping of Unicode ordinals to
     |          Unicode ordinals, strings, or None.
     |
     |      The table must implement lookup/indexing via __getitem__, for instance a
     |      dictionary or list.  If this operation raises LookupError, the character is
     |      left untouched.  Characters mapped to None are deleted.
     |
     |  upper(self, /)
     |      Return a copy of the string converted to uppercase.
     |
     |  zfill(self, width, /)
     |      Pad a numeric string with zeros on the left, to fill a field of the given width.
     |
     |      The string is never truncated.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.str:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  maketrans(...)
     |      Return a translation table usable for str.translate().
     |
     |      If there is only one argument, it must be a dictionary mapping Unicode
     |      ordinals (integers) or characters to Unicode ordinals, strings or None.
     |      Character keys will be then converted to ordinals.
     |      If there are two arguments, they must be strings of equal length, and
     |      in the resulting dictionary, each character in x will be mapped to the
     |      character at the same position in y. If there is a third argument, it
     |      must be a string, whose characters will be mapped to None in the result.

### class MultipleResultsError
     |  Method resolution order:
     |      MultipleResultsError
     |      InvalidResultError
     |      DataError
     |      DatabaseError
     |      Error
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Data descriptors inherited from Error:
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.Exception:
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  __str__(self, /)
     |      Return str(self).
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

### class NoResultError
     |  Method resolution order:
     |      NoResultError
     |      InvalidResultError
     |      DataError
     |      DatabaseError
     |      Error
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Data descriptors inherited from Error:
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.Exception:
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  __str__(self, /)
     |      Return str(self).
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

### class NotSupportedError
     |  Method resolution order:
     |      NotSupportedError
     |      DatabaseError
     |      Error
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Data descriptors inherited from Error:
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.Exception:
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  __str__(self, /)
     |      Return str(self).
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

### class NotificationHandler
     |  NotificationHandler(db, event, callback=None, arg_dict=None, timeout=None, stop_event=None)
     |
     |  A PostgreSQL client-side asynchronous notification handler.
     |
     |  Methods defined here:
     |
     |  __call__(self)
     |      Invoke the notification handler.
     |
     |      The handler is a loop that listens for notifications on the event
     |      and stop event channels.  When either of these notifications are
     |      received, its associated 'pid', 'event' and 'extra' (the payload
     |      passed with the notification) are inserted into its arg_dict
     |      dictionary and the callback is invoked with this dictionary as
     |      a single argument.  When the handler receives a stop event, it
     |      stops listening to both events and return.
     |
     |      In the special case that the timeout of the handler has been set
     |      to zero, the handler will poll all events synchronously and return.
     |      If will keep listening until it receives a stop event.
     |
     |      Note: If you run this loop in another thread, don't use the same
     |      database connection for database operations in the main thread.
     |
     |  __del__(self)
     |
     |  __init__(self, db, event, callback=None, arg_dict=None, timeout=None, stop_event=None)
     |      Initialize the notification handler.
     |
     |      You must pass a PyGreSQL database connection, the name of an
     |      event (notification channel) to listen for and a callback function.
     |
     |      You can also specify a dictionary arg_dict that will be passed as
     |      the single argument to the callback function, and a timeout value
     |      in seconds (a floating point number denotes fractions of seconds).
     |      If it is absent or None, the callers will never time out.  If the
     |      timeout is reached, the callback function will be called with a
     |      single argument that is None.  If you set the timeout to zero,
     |      the handler will poll notifications synchronously and return.
     |
     |      You can specify the name of the event that will be used to signal
     |      the handler to stop listening as stop_event. By default, it will
     |      be the event name prefixed with 'stop_'.
     |
     |  close(self)
     |      Stop listening and close the connection.
     |
     |  listen(self)
     |      Start listening for the event and the stop event.
     |
     |  notify(self, db=None, stop=False, payload=None)
     |      Generate a notification.
     |
     |      Optionally, you can pass a payload with the notification.
     |
     |      If you set the stop flag, a stop notification will be sent that
     |      will cause the handler to stop listening.
     |
     |      Note: If the notification handler is running in another thread, you
     |      must pass a different database connection since PyGreSQL database
     |      connections are not thread-safe.
     |
     |  unlisten(self)
     |      Stop listening for the event and the stop event.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)

### class OperationalError
     |  Method resolution order:
     |      OperationalError
     |      DatabaseError
     |      Error
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Data descriptors inherited from Error:
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.Exception:
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  __str__(self, /)
     |      Return str(self).
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

### class ProgrammingError
     |  Method resolution order:
     |      ProgrammingError
     |      DatabaseError
     |      Error
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Data descriptors inherited from Error:
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.Exception:
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  __str__(self, /)
     |      Return str(self).
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

### class Typecasts
     |  Dictionary mapping database types to typecast functions.
     |
     |  The cast functions get passed the string representation of a value in
     |  the database which they need to convert to a Python object.  The
     |  passed string will never be None since NULL values are already
     |  handled before the cast function is called.
     |
     |  Note that the basic types are already handled by the C extension.
     |  They only need to be handled here as record or array components.
     |
     |  Method resolution order:
     |      Typecasts
     |      builtins.dict
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  __missing__(self, typ)
     |      Create a cast function if it is not cached.
     |
     |      Note that this class never raises a KeyError,
     |      but returns None when no special cast function exists.
     |
     |  create_array_cast(self, basecast)
     |      Create an array typecast for the given base cast.
     |
     |  create_record_cast(self, name, fields, casts)
     |      Create a named record typecast for the given fields and casts.
     |
     |  dateformat(self)
     |      Return the current date format.
     |
     |      This method will be replaced with the dateformat() method of DbTypes.
     |
     |  get(self, typ, default=None)
     |      Get the typecast function for the given database type.
     |
     |  get_attnames(self, typ)
     |      Return the fields for the given record type.
     |
     |      This method will be replaced with the get_attnames() method of DbTypes.
     |
     |  reset(self, typ=None)
     |      Reset the typecasts for the specified type(s) to their defaults.
     |
     |      When no type is specified, all typecasts will be reset.
     |
     |  set(self, typ, cast)
     |      Set a typecast function for the specified database type(s).
     |
     |  ----------------------------------------------------------------------
     |  Class methods defined here:
     |
     |  get_default(typ) from builtins.type
     |      Get the default typecast function for the given database type.
     |
     |  set_default(typ, cast) from builtins.type
     |      Set a default typecast function for the given database type(s).
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |
     |  connection = None
     |
     |  defaults = {'anyarray': <built-in function cast_array>, 'bool': <funct...
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.dict:
     |
     |  __contains__(self, key, /)
     |      True if the dictionary has the specified key, else False.
     |
     |  __delitem__(self, key, /)
     |      Delete self[key].
     |
     |  __eq__(self, value, /)
     |      Return self==value.
     |
     |  __ge__(self, value, /)
     |      Return self>=value.
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __getitem__(...)
     |      x.__getitem__(y) <==> x[y]
     |
     |  __gt__(self, value, /)
     |      Return self>value.
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  __ior__(self, value, /)
     |      Return self|=value.
     |
     |  __iter__(self, /)
     |      Implement iter(self).
     |
     |  __le__(self, value, /)
     |      Return self<=value.
     |
     |  __len__(self, /)
     |      Return len(self).
     |
     |  __lt__(self, value, /)
     |      Return self<value.
     |
     |  __ne__(self, value, /)
     |      Return self!=value.
     |
     |  __or__(self, value, /)
     |      Return self|value.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __reversed__(self, /)
     |      Return a reverse iterator over the dict keys.
     |
     |  __ror__(self, value, /)
     |      Return value|self.
     |
     |  __setitem__(self, key, value, /)
     |      Set self[key] to value.
     |
     |  __sizeof__(...)
     |      D.__sizeof__() -> size of D in memory, in bytes
     |
     |  clear(...)
     |      D.clear() -> None.  Remove all items from D.
     |
     |  copy(...)
     |      D.copy() -> a shallow copy of D
     |
     |  items(...)
     |      D.items() -> a set-like object providing a view on D's items
     |
     |  keys(...)
     |      D.keys() -> a set-like object providing a view on D's keys
     |
     |  pop(...)
     |      D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
     |
     |      If the key is not found, return the default if given; otherwise,
     |      raise a KeyError.
     |
     |  popitem(self, /)
     |      Remove and return a (key, value) pair as a 2-tuple.
     |
     |      Pairs are returned in LIFO (last-in, first-out) order.
     |      Raises KeyError if the dict is empty.
     |
     |  setdefault(self, key, default=None, /)
     |      Insert key with a value of default if key is not in the dictionary.
     |
     |      Return the value for key if key is in the dictionary, else default.
     |
     |  update(...)
     |      D.update([E, ]**F) -> None.  Update D from dict/iterable E and F.
     |      If E is present and has a .keys() method, then does:  for k in E: D[k] = E[k]
     |      If E is present and lacks a .keys() method, then does:  for k, v in E: D[k] = v
     |      In either case, this is followed by: for k in F:  D[k] = F[k]
     |
     |  values(...)
     |      D.values() -> an object providing a view on D's values
     |
     |  ----------------------------------------------------------------------
     |  Class methods inherited from builtins.dict:
     |
     |  __class_getitem__(...) from builtins.type
     |      See PEP 585
     |
     |  fromkeys(iterable, value=None, /) from builtins.type
     |      Create a new dictionary with keys from iterable and values set to value.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.dict:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes inherited from builtins.dict:
     |
     |  __hash__ = None

### class Warning
     |  Method resolution order:
     |      Warning
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Data descriptors defined here:
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.Exception:
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  __str__(self, /)
     |      Return str(self).
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

## FUNCTIONS
### cast_array
        cast_array(string, cast=None, delim=',') -- cast a string as an array

### cast_hstore
        cast_hstore(string) -- cast a string as an hstore

### cast_record
        cast_record(string, cast=None, delim=',') -- cast a string as a record

### connect
        connect(dbname, host, port, opt) -- connect to a PostgreSQL database

        The connection uses the specified parameters (optional, keywords aware).

### escape_bytea
        escape_bytea(data) -- escape binary data for use within SQL as type bytea

### escape_string
        escape_string(string) -- escape a string for use within SQL

### get_array
        get_array() -- check whether arrays are converted as lists

### get_bool
        get_bool() -- check whether boolean values are converted to bool

### get_bytea_escaped
        get_bytea_escaped() -- check whether bytea will be returned escaped

### get_datestyle
        get_datestyle() -- get which date style is assumed

### get_decimal
        get_decimal() -- get the decimal type to be used for numeric values

### get_decimal_point
        get_decimal_point() -- get decimal point to be used for money values

### get_defbase
        get_defbase() -- return default database name

### get_defhost
        get_defhost() -- return default database host

### get_defopt
        get_defopt() -- return default database options

### get_defport
        get_defport() -- return default database port

### get_defuser
        get_defuser() -- return default database username

### get_jsondecode
        get_jsondecode() -- get the function used for decoding json results

### set_array
        set_array(on) -- set whether arrays should be converted to lists

### set_bool
        set_bool(on) -- set whether boolean values should be converted to bool

### set_bytea_escaped
        set_bytea_escaped(on) -- set whether bytea will be returned escaped

### set_datestyle
        set_datestyle(style) -- set which style is assumed

### set_decimal
        set_decimal(cls) -- set a decimal type to be used for numeric values

### set_decimal_point
        set_decimal_point(char) -- set decimal point to be used for money values

### set_defbase
        set_defbase(string) -- set default database name and return previous value

### set_defhost
        set_defhost(string) -- set default database host and return previous value

### set_defopt
        set_defopt(string) -- set default options and return previous value

### set_defpasswd
        set_defpasswd(password) -- set default database password

### set_defport
        set_defport(port) -- set default port and return previous value

### set_defuser
        [set_defuser(name)](https://www.chedong.com/phpMan.php/man/setdefuser/name/markdown) -- set default username and return previous value

### set_jsondecode
        set_jsondecode(func) -- set a function to be used for decoding json results

### set_query_helpers
        set_query_helpers(*helpers) -- set internal query helper functions

### unescape_bytea
        unescape_bytea(string) -- unescape bytea data retrieved as text

## DATA
    INV_READ = 262144
    INV_WRITE = 131072
    SEEK_CUR = 1
    SEEK_END = 2
    SEEK_SET = 0
    TRANS_ACTIVE = 1
    TRANS_IDLE = 0
    TRANS_INERROR = 3
    TRANS_INTRANS = 2
    TRANS_UNKNOWN = 4
    __all__ = ['DB', 'Adapter', 'NotificationHandler', 'Typecasts', 'Bytea...
    version = '5.1.2'

## VERSION
    5.1.2

## FILE
    /usr/lib/python3/dist-packages/pg.py


