l.s.d.p.ConnectionString : class documentation

Part of lp.services.database.postgresql View In Hierarchy

A libpq connection string.

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

Quoted or escaped values are not supported.

>>> 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 __eq__ Undocumented
Method __ne__ Undocumented
Method __hash__ 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 __eq__(self, other):
Undocumented
def __ne__(self, other):
Undocumented
def __hash__(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 2020-07-02 00:00:07.