Database URI parsing
Parse a URI and return a dictionary representing the parse results. This dictionary should have the following keys:
The plugin for this URI. This plugin also parses the URI itself.
Username, if given, or None if not. This key should not be provided if a username is not meaningful for this database.
A host name. '' generally means localhost, but may mean through a local socket. Should not be provided if not applicable.
The name of the database.
If the database is stored in a single file, the name of that file.
The original URI.
Any query-string parameters. Some of these may be consumed by the plugin/database connector, but should be present here anyway.
Other keys are allowed.
f remove_scheme(uri) ...
Return the URI with the scheme removed.
>>> remove_scheme('sqlite:table.db') 'table.db'
f parse_user_host(uri_wo_scheme) ...
Remove the user and host information. Returns (user, password, host, rest_of_uri). Expects to have remove_scheme() run first.
>>> parse_user_host('//pgsql@localhost/foo') ('pgsql', None, 'localhost', 'foo') >>> parse_user_host('///test') (None, None, '', 'test') >>> parse_user_host('//test:firstname.lastname@example.org/bar') ('test', 'pass', 'foo.com', 'bar')
f parse_query_string(uri, strict_parsing=True) ...
Given a URI (or a fragment, as returned by parse_user_host) return (uri_without_query_string, vars). vars is a dictionary of variables in the query string (after ?). If there are duplicate variables, they will show up as a list of values.
See the source for more information.