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
unable to connect to postgres using unix socket #257
Comments
sorry, i didn't see the contributor guidelines.. i'll send a message in chat |
I've posted messages in both gitter and discus and haven't gotten any response. As far as I can tell this is still an issue |
I'm using the following workaround until the regression can be fixed: # monkey patch
import asyncpg
async def connect_patched(self) -> None:
assert self._pool is None, "DatabaseBackend is already running"
kwargs = self._get_connection_kwargs()
self._pool = await asyncpg.create_pool(str(self._database_url), **kwargs)
# end monkey patch
import databases
database = databases.Database(database_url.__to_string__(hide_password=False))
database._backend.connect = types.MethodType(connect_patched, database._backend)
await database.connect() |
I did actually attach a PR to fix this issue, but the tests are failing. I haven't bothered to fix those because I haven't heard anything from the maintainers and I don't know if it solves the issue the way they would have wanted. |
this seems to be fixed by the fix for #250. closing... |
since this change #210 there does not appear to be a way to connect to a postgres database using a unix socket. DatabaseURL is using urllib urlsplit to parse the dsn, but in the case of a unix socket, the hostname component will be empty since the "hostname" in case of a socket, begins with /. Prior to the mentioned PR that didn't seem to be a blocking issue since the url string itself was passed to the asyncpg backend, however, now the parsed components are sent instead.
urlquoting the hostname part to preserve the / doesn't work either since the hostname component is not unquoted
The text was updated successfully, but these errors were encountered: