Skip to content

Adds multiple host handling via DSN parsing #257

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

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 March 4, 2018 01:11
Copy link
Member

@elprans elprans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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

egalpin commented Mar 5, 2018

Done 👍

Copy link
Member

@elprans elprans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants