6.3. Connection Object: pgobject

Table of Contents
query -- execute a SQL command
reset -- reset the connection
close -- close the database connection
fileno -- return the socket used to connect to the database
getnotify -- get the last notify from the server
inserttable -- insert a list into a table
putline -- write a line to the server socket [DA]
getline -- get a line from server socket [DA]
endcopy -- synchronize client and server [DA]
locreate -- create a large object in the database [LO]
getlo -- build a large object from given OID [LO]
loimport -- import a file to a PostgreSQL large object [LO]

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)