Closed jackwotherspoon closed 8 months ago
Hi @jackwotherspoon , since the asyncpg issue is blocked, I can have a look into this one. I see that the similar code changes are done in Cloud SQL connector, I can try to implement similar approach in Alloy DB connector as well. Let me know if it's fine!
@RahulDubey391 totally fine if you want to give this one a try 😄 That would be awesome!
Yes the linked description will point you in the right direction, however the implementation will be slightly different here.
For Cloud SQL Python Connector we use instance connection names which are in the format:
<PROJECT>:<REGION>:<INSTANCE_NAME>
, an example being my-cool-project:us-central1:my-postgres-instance
.
Where as for AlloyDB Python Connector we use instance URI's which are in the format:
projects/<PROJECT>/locations/<REGION>/clusters/<CLUSTER>/instances/<INSTANCE_NAME>,
an example being projects/my-cool-project/locations/us-central1/clusters/my-cool-cluster/instances/my-postgres-instance
. This means the regex and parsing will be a bit different.
Domain-scoped means that the <PROJECT>
field should be able to support a project name with a domain prefix attached to it in the format <DOMAIN>:<PROJECT>
.
You can copy the regex from our AlloyDB Go Connector implementation which already has this feature: https://github.com/GoogleCloudPlatform/alloydb-go-connector/blob/ce45ab73f0d13ccd2a113196d13dc2ca326f52f4/internal/alloydb/instance.go#L54-L85
That mixed with the Cloud SQL Python Connector PR linked above should help get you on your way. Feel free to ask any questions if need be 😄 Thanks again for the contributions
Hey @jackwotherspoon , thanks again for the guidance, much appreciated! Sure I'll create a PR and we can discuss from there. I'll use the reference you have provided for Go implementation and the existing Python connector for Cloud SQL.
Port over https://github.com/GoogleCloudPlatform/cloud-sql-python-connector/pull/937 for AlloyDB instance URIs
Should allow for
project
within instance URI to be domain-scoped (i.e have domain prefix included such asgoogle.com:project