c.d.p.ConnectionString : class documentation

Part of canonical.database.postgresql View In Hierarchy

A libpq connection string.

Some PostgreSQL tools take libpq connection strings. Other tools need the components seperated out (such as pg_dump command line arguments). This class allows you to switch easily between formats.

>>> cs = ConnectionString('user=foo dbname=launchpad_dev')
>>> cs.dbname
'launchpad_dev'
>>> cs.user
'foo'
>>> str(cs)
'dbname=launchpad_dev user=foo'
>>> repr(cs)
'dbname=launchpad_dev user=foo'
Method __init__ Undocumented
Method __repr__ Undocumented
Method asPGCommandLineArgs Return a string suitable for the PostgreSQL standard tools
Method asLPCommandLineArgs Return a string suitable for use by the LP tools using
def __init__(self, conn_str):
Undocumented
def __repr__(self):
Undocumented
def asPGCommandLineArgs(self):

Return a string suitable for the PostgreSQL standard tools command line arguments.

>>> cs = ConnectionString('host=localhost user=slony dbname=test')
>>> cs.asPGCommandLineArgs()
'--host=localhost --username=slony test'
>>> cs = ConnectionString('port=5433 dbname=test')
>>> cs.asPGCommandLineArgs()
'--port=5433 test'
def asLPCommandLineArgs(self):

Return a string suitable for use by the LP tools using db_options() to parse the command line.

>>> cs = ConnectionString('host=localhost user=slony dbname=test')
>>> cs.asLPCommandLineArgs()
'--host=localhost --user=slony --dbname=test'
API Documentation for Launchpad, generated by pydoctor at 2010-09-27 00:00:11.