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

asyncpg.create_pool fails with dsn with @ in password #436

Closed
kiddten opened this issue Apr 25, 2019 · 4 comments
Closed

asyncpg.create_pool fails with dsn with @ in password #436

kiddten opened this issue Apr 25, 2019 · 4 comments

Comments

@kiddten
Copy link

kiddten commented Apr 25, 2019

  • asyncpg version: 0.18.3
  • PostgreSQL version: 11.2
  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
    the issue with a local PostgreSQL install?
    :
  • Python version: 3.7.2
  • Platform: ubuntu
  • Do you use pgbouncer?:
  • Did you install asyncpg with pip?: yes
  • If you built asyncpg locally, which version of Cython did you use?:
  • Can the issue be reproduced under both asyncio and
    uvloop?
    :

It leads to different errors socket.gaierror such as [Errno -2] Name or service not known or [Errno -3] Temporary failure in name resolution

@eirnym
Copy link

eirnym commented Apr 25, 2019

Try to encode it with %40. It should work.

You may want to read this and this documentation.

Additionally, you can use PGPASSFILE file to store your passwords as documented here

@fgimian
Copy link

fgimian commented Oct 2, 2019

I'm still experiencing issues with this when a # is in the password and I use the DSN. As per the related issue above, this affects the databases library too which passes the DSN directly to asyncpg.

Note: I've replaced sensitive names in the following example

# This does not work
await asyncpg.connect(
    "postgresql://myapp:Password%23123@localhost:5432/myapp"
)

# This works
await asyncpg.connect(
    user="myapp",
    password="Password#123",
    host="localhost",
    port=5432,
    database="myapp"
)

Of course, not URL encoding the password doesn't work either as urlparse fails to split it correctly.

Kindest regards
Fotis

@elprans
Copy link
Member

elprans commented Oct 3, 2019

This should be fixed by #472

@fgimian
Copy link

fgimian commented Oct 3, 2019

This should be fixed by #472

Awesome stuff, thank you so much! 😄

@elprans elprans closed this as completed Oct 3, 2019
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

No branches or pull requests

4 participants