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 |
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'