The DBAPI level supported, currently “2.0”.
This property is part of the DBAPI 2.0 specification.
Integer constant stating the level of thread safety the DBAPI interface supports. This DBAPI module supports sharing the module, connections, and cursors, resulting in a threadsafety value of 3.
This property is part of the DBAPI 2.0 specification.
String property stating the type of parameter marker formatting expected by the interface. This value defaults to “format”, in which parameters are marked in this format: “WHERE name=%s”.
This property is part of the DBAPI 2.0 specification.
As an extension to the DBAPI specification, this value is not constant; it can be changed to any of the following values:
- qmark
- Question mark style, eg. WHERE name=?
- numeric
- Numeric positional style, eg. WHERE name=:1
- named
- Named style, eg. WHERE name=:paramname
- format
- printf format codes, eg. WHERE name=%s
- pyformat
- Python format codes, eg. WHERE name=%(paramname)s
Creates a connection to a PostgreSQL database.
This function is part of the DBAPI 2.0 specification; however, the arguments of the function are not defined by the specification. pg8000 guarentees that for all v1.xx releases, no optional parameters will be removed from the function definition.
Parameters: |
|
---|---|
Return type: | An instance of pg8000.dbapi.ConnectionWrapper. |
Constuct an object holding a date value.
This function is part of the DBAPI 2.0 specification.
Return type: | datetime.date |
---|
Construct an object holding a time value.
This function is part of the DBAPI 2.0 specification.
Return type: | datetime.time |
---|
Construct an object holding a timestamp value.
This function is part of the DBAPI 2.0 specification.
Return type: | datetime.datetime |
---|
Construct an object holding a date value from the given ticks value (number of seconds since the epoch).
This function is part of the DBAPI 2.0 specification.
Return type: | datetime.date |
---|
Construct an objet holding a time value from the given ticks value (number of seconds since the epoch).
This function is part of the DBAPI 2.0 specification.
Return type: | datetime.time |
---|
Construct an object holding a timestamp value from the given ticks value (number of seconds since the epoch).
This function is part of the DBAPI 2.0 specification.
Return type: | datetime.datetime |
---|
Construct an object holding binary data.
This function is part of the DBAPI 2.0 specification.
Return type: | pg8000.types.Bytea |
---|
A ConnectionWrapper instance represents a single physical connection to a PostgreSQL database. To construct an instance of this class, use the connect() function.
Creates a CursorWrapper instance bound to this connection.
This function is part of the DBAPI 2.0 specification.
Commits the current database transaction.
This function is part of the DBAPI 2.0 specification.
Rolls back the current database transaction.
This function is part of the DBAPI 2.0 specification.
Closes the database connection.
This function is part of the DBAPI 2.0 specification.
A list of server-side notifications received by this database connection (via the LISTEN/NOTIFY PostgreSQL commands). Each list element is a two-element tuple containing the PostgreSQL backend PID that issued the notify, and the notification name.
PostgreSQL will only send notifications to a client between transactions. The contents of this property are generally only populated after a commit or rollback of the current transaction.
This list can be modified by a client application to clean out notifications as they are handled. However, inspecting or modifying this collection should only be done while holding the notifies_lock lock in order to guarantee thread-safety.
This attribute is not part of the DBAPI standard; it is a pg8000 extension.
New in version 1.07.
A threading.Lock object that should be held to read or modify the contents of the notifies list.
This attribute is not part of the DBAPI standard; it is a pg8000 extension.
New in version 1.07.
All of the standard database exception types are accessible via connection instances.
This is a DBAPI 2.0 extension. Accessing any of these attributes will generate the warning DB-API extension connection.DatabaseError used.
To construct an instance of this class, use the pg8000.dbapi.ConnectionWrapper.cursor() method.
This read-only attribute contains a reference to the connection object (an instance of ConnectionWrapper) on which the cursor was created.
This attribute is part of a DBAPI 2.0 extension. Accessing this attribute will generate the following warning: DB-API extension cursor.connection used.
This read-only attribute contains the number of rows that the last execute method produced (for query statements like SELECT) or affected (for modification statements like UPDATE).
During a query statement, accessing this property requires reading the entire result set into memory. It is preferable to avoid using this attribute to reduce memory usage.
The value is -1 in case no execute method has been performed on the cursor, or there was no rowcount associated with the last operation.
This attribute is part of the DBAPI 2.0 specification.
This read-only attribute is a sequence of 7-item sequences. Each value contains information describing one result column. The 7 items returned for each column are (name, type_code, display_size, internal_size, precision, scale, null_ok). Only the first two values are provided by the current implementation.
This attribute is part of the DBAPI 2.0 specification.
Executes a database operation. Parameters may be provided as a sequence, or as a mapping, depending upon the value of pg8000.dbapi.paramstyle.
This method is part of the DBAPI 2.0 specification.
Parameters: |
|
---|
Prepare a database operation, and then execute it against all parameter sequences or mappings provided.
This method is part of the DBAPI 2.0 specification.
Parameters: |
|
---|
Fetch the next row of a query result set.
This method is part of the DBAPI 2.0 specification.
Returns: | A row as a sequence of field values, or None if no more rows are available. |
---|
Fetches the next set of rows of a query result.
This method is part of the DBAPI 2.0 specification.
Parameters: |
|
---|---|
Returns: | A sequence, each entry of which is a sequence of field values making up a row. If no more rows are available, an empty sequence will be returned. |
Fetches all remaining rows of a query result.
This method is part of the DBAPI 2.0 specification.
Returns: | A sequence, each entry of which is a sequence of field values making up a row. |
---|
Performs a PostgreSQL COPY query to stream data in or out of the PostgreSQL server.
These methods are not part of the standard DBAPI, they are a pg8000 extension. They are designed to be compatible with similar methods provided by psycopg2.
Parameters: |
|
---|---|
Raises: | CopyQueryOrTableRequiredError when neither table nor query parameters are provided. |
New in version 1.07.
Closes the cursor.
This method is part of the DBAPI 2.0 specification.
A cursor object is iterable to retrieve the rows from a query.
This is a DBAPI 2.0 extension. Accessing these methods will generate a warning, DB-API extension cursor.next() used and DB-API extension cursor.__iter__() used.
This exception is part of the DBAPI 2.0 specification.
This exception is part of the DBAPI 2.0 specification.
See pg8000.errors.InterfaceError
This exception is part of the DBAPI 2.0 specification.
See pg8000.errors.DatabaseError
This exception is part of the DBAPI 2.0 specification.
See pg8000.errors.InternalError
This exception is part of the DBAPI 2.0 specification.
See pg8000.errors.OperationalError
This exception is part of the DBAPI 2.0 specification.
See pg8000.errors.ProgrammingError
This exception is part of the DBAPI 2.0 specification.
See pg8000.errors.IntegrityError
This exception is part of the DBAPI 2.0 specification.
This exception is part of the DBAPI 2.0 specification.
See pg8000.errors.NotSupportedError
This exception is part of the DBAPI 2.0 specification.