- Notifications
You must be signed in to change notification settings - Fork 435
Description
Hi,
I'm trying to use asyncpg to connect to Google Cloud SQL together with [databases](https://github.com/encode/databases/), alembic and sometimes sqlalchemy. It's quite convenient to have one database url that can be used in different cases.
But there's one problem as the Cloud SQL host is in the format /cloudsql/<project>:<region>:<db_instance>.
Unfortunately, it breaks the parsing around https://github.com/MagicStack/asyncpg/blob/master/asyncpg/connect_utils.py#L182, so the port and host cannot be distinguished unless host is explicitly passed as kwarg.
Would it be possible to consider adding the support for such a case?
Naive solution seems to be to use rpartition there, so the url
'postgresql://USER:PWD@/DB?host=/cloudsql/::<db_instance>:5432'
can be used, but I can investigate this one more thorough if seems like a reasonable case.