psycopg2 API reference
50 public APIs from psycopg2 (psycopg/psycopg2) — 34 classes, 1 functions, 15 methods. Signatures extracted by static analysis of the actual source.
Repository: psycopg/psycopg2
| Kind | Count |
|---|---|
| Classes | 34 |
| Functions | 1 |
| Methods | 15 |
API list
method
lib._json.Json.dumps(obj)Serialize *obj* in JSON format.
class
lib._range.DateRangeRepresents :sql:`daterange` values.
class
lib._range.DateTimeRangeRepresents :sql:`tsrange` values.
class
lib._range.DateTimeTZRangeRepresents :sql:`tstzrange` values.
class
lib._range.NumberRangeAdapterAdapt a range if the subtype doesn't need quotes.
class
lib._range.RangePython representation for a PostgreSQL |range|_ type.
method
lib._range.Range.isempty()`!True` if the range is empty.
method
lib._range.Range.lower()The lower bound of the range.
method
lib._range.Range.upper()The upper bound of the range.
class
lib._range.RangeAdapter`ISQLQuote` adapter for `Range` subclasses.
func
lib.connect(dsn=None, connection_factory=None, cursor_factory=None, **kwargs)Create a new database connection.
class
lib.extensions.NoneAdapterAdapt None to NULL.
class
lib.extensions.SQL_INAdapt any iterable to an SQL quotable object.
class
lib.extras.DictConnectionA connection that uses `DictCursor` automatically.
class
lib.extras.DictCursorA cursor that keeps a list of column name -> index mappings__.
class
lib.extras.DictCursorBaseBase class for all dict-like cursors.
class
lib.extras.DictRowA row object that allow by-column-name access to data.
class
lib.extras.HstoreAdapterAdapt a Python dict to the hstore syntax.
class
lib.extras.InetWrap a string to allow for correct SQL-quoting of inet values.
class
lib.extras.LoggingConnectionA connection that logs all queries to a file or logger__ object.
method
lib.extras.LoggingConnection.filter(msg, curs)Filter the query before logging it.
class
lib.extras.LoggingCursorA cursor that logs queries using its connection logging facilities.
class
lib.extras.MinTimeLoggingConnectionA connection that logs queries based on execution time.
class
lib.extras.MinTimeLoggingCursorThe cursor sub-class companion to `MinTimeLoggingConnection`.
class
lib.extras.NamedTupleConnectionA connection that uses `NamedTupleCursor` automatically.
class
lib.extras.NamedTupleCursorA cursor that generates results as `~collections.namedtuple`.
class
lib.extras.RealDictConnectionA connection that uses `RealDictCursor` automatically.
class
lib.extras.RealDictCursorA cursor that uses a real dict as the base type for rows.
class
lib.extras.RealDictRowA `!dict` subclass representing a data record.
class
lib.extras.ReplicationCursorA cursor used for communication on replication connections.
method
lib.extras.ReplicationCursor.drop_replication_slot(slot_name)Drop streaming replication slot.
class
lib.extras.UUID_adapterAdapt Python's uuid.UUID__ type to PostgreSQL's uuid__.
class
lib.pool.AbstractConnectionPoolGeneric key-based pooling code.
class
lib.pool.ThreadedConnectionPoolA connection pool that works with the threading module.
method
lib.pool.ThreadedConnectionPool.putconn(conn=None, key=None, close=False)Put away an unused connection.
class
lib.sql.ComposableAbstract base class for objects that can be used to compose an SQL string.
method
lib.sql.Composable.as_string(context)Return the string value of the object.
class
lib.sql.ComposedA `Composable` object made of a sequence of `!Composable`.
method
lib.sql.Composed.seq()The list of the content of the `!Composed`.
method
lib.sql.Identifier.string()The string wrapped by the `Identifier`.
class
lib.sql.LiteralA `Composable` representing an SQL value to include in a query.
method
lib.sql.Literal.wrapped()The object wrapped by the `!Literal`.
class
lib.sql.PlaceholderA `Composable` representing a placeholder for query parameters.
method
lib.sql.Placeholder.name()The name of the `!Placeholder`.
class
lib.sql.SQLA `Composable` representing a snippet of SQL statement.
method
lib.sql.SQL.format(*args, **kwargs)Merge `Composable` objects into a template.
method
lib.sql.SQL.join(seq)Join a sequence of `Composable`.
method
lib.sql.SQL.string()The string wrapped by the `!SQL` object.
class
lib.tz.FixedOffsetTimezoneFixed offset in minutes east from UTC.
class
lib.tz.LocalTimezonePlatform idea of local timezone.
About this data
These signatures were extracted from the public source of psycopg/psycopg2
using Python's ast module. Argument names, default values,
type annotations and return types are taken verbatim from the code.
Implementation bodies are never stored. See
how it works for details.