Message Types
This document contains autoclass definitions for all of the various message types used throughout the library. These are returned from all three layers of API, although some only at certain levels.
Base Classes
These classes are never returned directly, but are supertypes to other message classes.
- class pg_purepy.messages.PostgresMessage
Bases:
object
Base class for a PostgreSQL protocol message.
- class pg_purepy.messages.QueryResultMessage
Bases:
PostgresMessage
,ABC
Superclass for query results.
State-related messages
These classes usually represent some form of internal state change.
- class pg_purepy.messages.ParameterStatus(name, value)
Bases:
PostgresMessage
Returned when a configuration parameter is changed, e.g. via SET.
- class pg_purepy.messages.ErrorOrNoticeResponse(notice, recoverable, severity_localised, severity, code, message, hint=None, detail=None, position=None, internal_position=None, internal_query=None, where=None, schema_name=None, table_name=None, column_name=None, data_type_name=None, constraint_name=None)
Bases:
PostgresMessage
Returned when an error or a notice message is produced from the server.
- class pg_purepy.messages.ReadyForQuery(state)
Bases:
PostgresMessage
Returned when the protocol machine is ready for the next query cycle.
-
state:
ReadyForQueryState
The sub-state that the current connection is in.
-
state:
- class pg_purepy.messages.ReadyForQueryState(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
Enum
Enumeration of possible ReadyForQuery states.
- IDLE = 73
The server is idle and not in any transaction.
- IN_TRANSACTION = 84
The server is currently in a transaction, and new commands can be issued.
- ERRORED_TRANSACTION = 69
The server is currently in a transaction that has errored, and no new commands can be issued.
Auth-related messages
These classes relate to the authentication loop.
- class pg_purepy.messages.AuthenticationRequest(method, md5_salt=None, sasl_methods=[])
Bases:
PostgresMessage
Returned when the PostgreSQL server requires authentication.
-
method:
AuthenticationMethod
The authentication method required.
-
method:
- class pg_purepy.messages.AuthenticationMethod(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
IntEnum
Enumeration of supported authentication methods.
- CLEARTEXT = 3
The server wishes for us to send our password in clear text.
- MD5 = 5
The server wishes for us to use MD5 hashing for our password.
- SASL = 10
The server wishes for us to use SASL authentication.
- class pg_purepy.messages.BackendKeyData(pid, secret_key)
Bases:
PostgresMessage
Misc data used for cancellation.
- class pg_purepy.messages.AuthenticationCompleted
Bases:
PostgresMessage
Returned when authentication is completed.
Query-related messages
These classes relate to parts of the query cycle.
Both simple and extended queries:
- class pg_purepy.messages.ColumnDescription(name, table_oid, column_index, type_oid, column_length, type_modifier)
Bases:
object
A description of a column.
- class pg_purepy.messages.RowDescription(columns)
Bases:
QueryResultMessage
Describes the rows of a query.
-
columns:
list
[ColumnDescription
] The list of
ColumnDescription
instances that wraps the decoding info for each column returned in this row.
-
columns:
- class pg_purepy.messages.DataRow(description, data)
Bases:
QueryResultMessage
A singular data row. This contains a
RowDescription
and a list of converted data values.-
description:
RowDescription
The
RowDescription
that describes the data within this row.
-
description:
- class pg_purepy.messages.CommandComplete(tag, row_count)
Bases:
QueryResultMessage
Returned when a single query command is complete.
Extended queries only:
- class pg_purepy.messages.ParseComplete(statement_name)
Bases:
PostgresMessage
Returned when parsing a prepared statement completes.
- class pg_purepy.messages.ParameterDescription(oids)
Bases:
PostgresMessage
Returned when parsing a ParameterDescription message.
- class pg_purepy.messages.PreparedStatementInfo(name, parameter_oids, row_description)
Bases:
PostgresMessage
Contains the state of a prepared statement. Returned for a RowDescription over a prepared statement.
-
parameter_oids:
ParameterDescription
The
ParameterDescription
for the parameters for this prepared statement.
-
row_description:
Optional
[RowDescription
] The
RowDescription
of the incoming row data of the prepared statement. This may be None if this query doesn’t return any data.
-
parameter_oids:
- class pg_purepy.messages.BindComplete
Bases:
PostgresMessage
Returned when a Bind message completes successfully.