Skip to content
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

Must use dsn to create connections on Windows #184

Closed
sgtlaggy opened this issue Sep 2, 2017 · 3 comments
Closed

Must use dsn to create connections on Windows #184

sgtlaggy opened this issue Sep 2, 2017 · 3 comments
Labels

Comments

@sgtlaggy
Copy link

sgtlaggy commented Sep 2, 2017

With either asyncpg.connect or asyncpg.create_pool, you must pass dsn, and cannot pass host/port/user/password/etc as args.
I feel this should be mentioned in the docs or amended.
My personal solution would be a system check or try/except NotImplementedError here and fall back to loop.create_connection.

@elprans
Copy link
Member

elprans commented Sep 2, 2017

That shouldn't be the case. There are tests, and they pass on Windows. Do you mind providing a code snippet that doesn't work for you?

My personal solution would be a system check or try/except NotImplementedError here and fall back to loop.create_connection.

The line you highlighted is the Unix socket connection, and should not be reached on Windows, if you provided the hostname correctly.

@sgtlaggy
Copy link
Author

sgtlaggy commented Sep 3, 2017

It appears not passing the host argument is the issue, I'll admit I didn't actually try the host arg before reporting this. Relying on it automatically resolving to 'localhost' causes it to attempt a unix connection with the default Unix paths it tries here.

@elprans elprans added the bug label Sep 5, 2017
@elprans
Copy link
Member

elprans commented Sep 5, 2017

That does seem like a bug.

elprans added a commit that referenced this issue Sep 12, 2017
… set

When the host is not passed explicitly to `connect()`, asyncpg tries
to find a suitable socket in a few known directories.  On Windows, where
there are no file sockets, we should connect directly to 'localhost'
instead.

Fixes: #184.
elprans added a commit that referenced this issue Sep 12, 2017
… set

When the host is not passed explicitly to `connect()`, asyncpg tries
to find a suitable socket in a few known directories.  On Windows, where
there are no file sockets, we should connect directly to `localhost`
instead.

Fixes: #184.
elprans added a commit that referenced this issue Sep 12, 2017
… set

When the host is not passed explicitly to `connect()`, asyncpg tries
to find a suitable socket in a few known directories.  On Windows, where
there are no file sockets, we should connect directly to `localhost`
instead.

Fixes: #184.
elprans added a commit that referenced this issue Sep 12, 2017
… set

When the host is not passed explicitly to `connect()`, asyncpg tries
to find a suitable socket in a few known directories.  On Windows, where
there are no file sockets, we should connect directly to `localhost`
instead.

Fixes: #184.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants