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

Adds multiple host handling via DSN parsing #257

Closed
wants to merge 1 commit into from

Conversation

@egalpin
Copy link

@egalpin egalpin commented Feb 7, 2018

If there is a way to do this by formatting a DSN in a way the urllib.parse can already handle, please feel free to document here and close this out. Thanks!

@elprans elprans self-requested a review Mar 4, 2018
@elprans
elprans approved these changes Mar 4, 2018
Copy link
Member

@elprans elprans left a comment

Looks good! Would you mind squashing the commits? Thanks!

@egalpin egalpin force-pushed the egalpin:add-multi-host-dsn branch from 5832722 to f5654bd Mar 5, 2018
@egalpin
Copy link
Author

@egalpin egalpin commented Mar 5, 2018

Done 👍

Copy link
Member

@elprans elprans left a comment

Actually, looking closer, I don't think the parsing is correct.

The general URI form is:

postgresql://[user[:password]@][netloc][:port][,...][/dbname][?param1=value1&...]

So, each comma-separated part has its own user/password/host/port tuple, while your implementation assumes that it's only the host part that is comma-separated sharing the other connection bits.

elprans added a commit that referenced this pull request Sep 19, 2018
The behavior matches that of libpq.  Multiple hosts can now be specified
in the DSN, e.g. `postgres://host1,host2:5433`.  The `host` and `port`
arguments now also accept lists.  Like libpq, asyncpg will select the
first host it can successfully connect to.

Closes: #257
Related: #352
elprans added a commit that referenced this pull request Oct 23, 2018
The behavior matches that of libpq.  Multiple hosts can now be specified
in the DSN, e.g. `postgres://host1,host2:5433`.  The `host` and `port`
arguments now also accept lists.  Like libpq, asyncpg will select the
first host it can successfully connect to.

Closes: #257
Related: #352
@elprans elprans closed this in #365 Oct 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.