Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

connect doesn't support connection URIs

#185

Submitted by: Joe F

According to the documentation for connect:

The connection parameters can be
specified as a libpq connection string using the dsn parameter

However, passing in a connection URL fails with an error:

psycopg2.OperationalError: missing "=" after "postgresql://postgres@localhost:2345/test" in connection info string

According to the DBI 2.0 spec, connection parameters are db specific, and the URI form is definitely allowed by libpq:

http://www.postgresql.org/docs/current/static/libpq-connect.html#LI...

Using a URI is advantageous because it allows the db (and parameters) to be specified in one config variable or command line arg instead of spread across many. It's also more compatible with other runtimes thus allowing the same enviroment variable to be used for, say, a c program, a java program and a python script.

Reported by Psycopg website · October 14th, 2013 @ 08:52 PM

State: invalid
Milestone: none
Assigned to: nobody

Activity

  1. Daniele Varrazzo
    Daniele Varrazzo
    • State changed from new to invalid

    Psycopg doesn't parse the connection string: it is passed verbatim to the libpq.

    In [3]: psycopg2.connect("postgresql://postgres@localhost:5432/test")
    Out[3]: <connection object at 0x178fbc0; dsn: 'postgresql://postgres@localhost:5432/test', closed: 0>
    

    you have an older libpq on your client, one that doesn't support the URI syntax yet.

    October 15th, 2013 @ 10:07 AM