Skip to content

Allow unix socket connections with DB-API #52

Description

@avbidder

c = dbapi20.connect(unix='/var/run/postgresql/.s.PGSQL.5432', database='msgid-test')

tells me that "host" and "unix" conflict. But I didn't give a "host" at all.

Additionally: it should be possible to connect to the default location for the unix socket

Additionally: the parameters to connect() are database specific according to the DB-API PEP, but connect() doesn't even have a docstring. Yes, it is "obvious" that connect() internally uses the same stuff as the PQ-API connect methods. Except that it's not obvious and (see above) the options are somehow modified before they're passed on.

(and yes, I want to use DB-API as far as I can.)

Activity

  1. jwp commented on Jan 7, 2011

    @jwp
    Contributor

    Thank you very much for the report. I'll look into this soon.

    AFA default location and unix socket is concerned, it's a little difficult considering that the socket directory is configurable and subject to the installation of PostgreSQL. For libpq based drivers, it's no problem because it's part of the postgresql install and therefore it knows where to look. py-postgresql has no knowledge of where PG keeps its file system sockets.

  2. avbidder commented on Jan 7, 2011

    @avbidder
    Author

    Ok, I missed that py-postgresql doesn't use libpq.

    Maybe for convenience have a list of frequently used locations (Debian / RedHat / SuSE / Solaris / ...) and try to use them.

    Or: if unix domain socket is requested, the server is installed on the same machine anyway, maybe there's some way to find the socket? But I appreciate that this part of the request is not easy.

  3. jwp commented on Aug 10, 2012

    @jwp
    Contributor

    Just bumping this issue noting that I haven't forgotten about it.

  4. jwp commented on Aug 3, 2018

    @jwp
    Contributor

    Setting the host and port keywords to None is a workaround for this. The issue comes from the default parameters being built presume host localhost and port 5432. Additionally, dbapi20.driver.connect can be used directly to avoid the defaults altogether.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions