Getting Ready to Use the Python Database API with Red Hat Database

To use the Python Database API, you need the Python interpreter as well as the Red Hat Database implementation of the Python DB-API, pgdb.py.

Getting and Installing Python and the Database API Code

Python is freely available at http://www.python.org. Red Hat currently ships their Linux distribution with Python version 1.5.2.

Red Hat Database ships with the RHDB implementation of the Python Database API. The module is contained in the rh-postgresql-python package. Once installed, you can find the Python Database API module in /usr/lib/python1.5/site-packages. This module, pgdb.py, is compliant with the Python Database API Specification Version 2.0. Refer to the Red Hat Database Getting Started / Installation Guide for details on installing this package.

The Python Database API Specification states that the preferred object types for the date/time objects are those defined in the mxDateTime package. Red Hat Linux ships with the mx-2.0.1-1 RPM, which is the 2.0.1 version of the eGenix.com mx Extensions for Python. Included in this package is the mxDateTime module.

Setting Up Red Hat Database

As the RHDB Python Database API implementation uses TCP/IP to communicate with the database server, the postmaster must be started with TCP/IP enabled. To enable TCP/IP, you can modify the tcpip_socket setting in the postgresql.conf file and restart the postmaster. Alternatively, you can start that postmaster with the -i option. Refer to the Red Hat Database Administrator and User's Guide for further information on enabling TCP/IP connections.