PyGreSQL
PyGreSQL is a Python - programming library to respond to a PostgreSQL database. The module pg provided for this is written in the programming language C and defines the three objects pgpbject , pgqueryobject and pglargeobject in addition to the connect method . The connection object ( pgobject ) is used to manage parameters of a PostgreSQL connection and can be accessed via functions. The query result object ( pgqueryobject ) provides methods for evaluating query results that are generated from pgobject using the query method . Here are a few examples:
- x = db.query ("select name from states order by name")
- x.getresult () - Result is of the list type, i. H. all access types and methods on lists provided by Python can be used
- x.ntuples () - number of delivered records
- x.listfields () - writes the names of the result columns in the list
There is also a pgdb module which implements the DB-API 2.0 defined in PEP 249, this enables a simple change to other database systems or from other database systems to PostgreSQL.