9.3. Connection object: pgobject

This object handles a connection to the PostgreSQL database. It embeds and hides all the parameters that define this connection, leaving just really significant parameters in function calls.

Some methods give direct access to the connection socket. They are specified by the tag [DA]. Do not use them unless you really know what you are doing. If you prefer disabling them, set the -DNO_DIRECT option in the Python Setup file.

Some other methods give access to large objects. if you want to forbid access to these from the module, set the -DNO_LARGE option in the Python Setup file. These methods are specified by the tag [LO].

Every pgobject defines a set of read-only attributes that describe the connection and its status. These attributes are:

host

the host name of the server (string)

port

the port of the server (integer)

db

the selected database (string)

options

the connection options (string)

tty

the connection debug terminal (string)

user

user name on the database system (string)

status

the status of the connection (integer: 1 - OK, 0 - BAD)

error

the last warning/error message from the server (string)