-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow unix socket connections with DB-API #52
Comments
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. |
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. |
Just bumping this issue noting that I haven't forgotten about it. |
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. |
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.)
The text was updated successfully, but these errors were encountered: