Text Size: Normal / Large

6.2. pg Module Functions

Table of Contents
connect -- open a connection to the database server
get_defhost -- get default host name [DV]
set_defhost -- set default host name [DV]
get_defport -- get default port [DV]
set_defport -- set default port [DV]
get_defopt -- get default options specification [DV]
set_defopt -- set default options specification [DV]
get_deftty -- get default connection debug terminal specification [DV]
set_deftty -- set default connection debug terminal specification [DV]
get_defbase -- get default database name specification [DV]
set_defbase -- set default database name specification [DV]

pg module defines only a few methods that allow to connect to a database and to define "default variables" that override the environment variables used by PostgreSQL.

These "default variables" were designed to allow you to handle general connection parameters without heavy code in your programs. You can prompt the user for a value, put it in the default variable, and forget it, without having to modify your environment. The support for default variables can be disabled by setting the -DNO_DEF_VAR option in the Python Setup file. Methods relative to this are specified by the tag [DV].

All variables are set to None at module initialization, specifying that standard environment variables should be used.


User Comments

No comments could be found for this page.

Add Comment

Please use this form to add your own comments regarding your experience with particular features of PostgreSQL, clarifications of the documentation, or hints for other users. Please note, this is not a support forum, and your IP address will be logged. If you have a question or need help, please see the faq, try a mailing list, or join us on IRC. Note that submissions containing URLs or other keywords commonly found in 'spam' comments may be silently discarded. Please contact the webmaster if you think this is happening to you in error.

In order to submit a comment, you must have a community account.

* Comment
 

* denotes required field

Privacy Policy | Project hosted by hub.org | Designed by tinysofa
Copyright © 1996 – 2007 PostgreSQL Global Development Group