-
Notifications
You must be signed in to change notification settings - Fork 419
Support for Cloud SQL host within the dsn #419
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
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 <[email protected]>
Contributes to MagicStack#419 Signed-off-by: Sylvain Hellegouarch <[email protected]>
Contributes to MagicStack#419 Signed-off-by: Sylvain Hellegouarch <[email protected]>
Contributes to #419 Signed-off-by: Sylvain Hellegouarch <[email protected]>
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:
|
Anyone actually answer this for you? I'm not able to get this going and there doesn't seem to be a clear example/overview of expected format. |
Cloud run can't connect to Cloud SQL, have someone has correct url format for Cloud SQL
|
this is correct url format
and cloud run must be configured to specify which instance you wanna connect to
|
FYI - When I tried setting the scheme to "postgresql+asyncpg" as recommended in the previous comment, I got the following error:
Using asyncpg v0.29.0. |
Hi,
I'm trying to use asyncpg to connect to Google Cloud SQL together with
[databases](https://github.com/encode/databases/)
,alembic
and 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
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.
The text was updated successfully, but these errors were encountered: