MagicStack / asyncpg Public
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
Support for Cloud SQL host within the dsn #419
Comments
|
Can you show the URL you are using with sqlalchemy? |
|
The url is so but I have to make a workaround to pass |
|
It could be either the result is similar. |
|
Bumping this - am having the exact same issue. |
|
Try URL encoding the colons? |
|
Hi there, I'm trying to figure the state of this issue and it's not clear to me. Are we able to pass the CloudSQL |
|
Looking through the code a bit more. It seems the logic is to assume Host:Port from the get go (and call _parse_hostlist). Maybe a check before calling that function for the host starting with a |
Contributes to MagicStack#419 Signed-off-by: Sylvain Hellegouarch <sh@defuze.org>
Contributes to MagicStack#419 Signed-off-by: Sylvain Hellegouarch <sh@defuze.org>
Contributes to MagicStack#419 Signed-off-by: Sylvain Hellegouarch <sh@defuze.org>
Contributes to #419 Signed-off-by: Sylvain Hellegouarch <sh@defuze.org>
|
This is working now in the latest version (with #470), maybe someone can close this ticket to avoid confusion? |
|
awesome news @maxzheng! |
|
Hi @maxzheng Can you tell me in detail how you made it work? I have been trying: |
Hi,
I'm trying to use asyncpg to connect to Google Cloud SQL together with
[databases](https://github.com/encode/databases/),alembicand sometimessqlalchemy. 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
hostis explicitly passed as kwarg.Would it be possible to consider adding the support for such a case?
Naive solution seems to be to use
rpartitionthere, 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.
The text was updated successfully, but these errors were encountered: