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

Issue with connection to database with postgres (asyncpg) #92

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

Issue with connection to database with postgres (asyncpg) #92

kiddten opened this issue Apr 24, 2019 · 4 comments

Comments

@kiddten
Copy link

kiddten commented Apr 24, 2019

There is simplified example extracted from /databases/backends/postgres.py:connect()

import asyncio

import asyncpg

from databases import DatabaseURL

async def run():
    url = 'postgresql://user:password@localhost/dbname'
    pool = await asyncpg.create_pool(str(DatabaseURL(url)))


loop = asyncio.get_event_loop()
loop.run_until_complete(run())

I am getting error socket.gaierror: [Errno -3] Temporary failure in name resolution and that's fair since according to https://magicstack.github.io/asyncpg/current/api/index.html#connection-pools accepts dsn (str) – Connection arguments specified using as a single string in the following format: postgres://user:pass@host:port/database?option=value like that.

So we need to add some note to docs maybe or handle that situation via advanced parsing maybe..

@kiddten
Copy link
Author

kiddten commented Apr 24, 2019

Whoops just read my comment again and that is exactly same format 🤣
But there is still an issue related to gaierror
Thought when I'am trying to execute await asyncpg.connect(user=, password=, etc) with kwargs thats work..

@tomchristie
Copy link
Member

I didn't understand the issue. Could you try to rephrase it?
What do I need to do to reproduce the issue?

@kiddten
Copy link
Author

kiddten commented Apr 25, 2019

@tomchristie I've figured out what's going on. Details MagicStack/asyncpg#436

@tomchristie
Copy link
Member

Okay, thanks for the update.

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

2 participants