Description
The Cloud SQL Python Connector would like to support database connections to Cloud SQL using asyncpg. The Cloud SQL connectors connect to a server side proxy that authorizes users based on a TLS client cert. In order to do this in asyncpg, we require the ability to configure the connection level SSL (outside of the database protocol) or pass in an existing connection (with its own SSL/TLS configuration).
For the pg8000 driver, we use the first option – their ssl_context
argument allows us to pass in our pre-configured ssl.SSLContext object as long as the custom require_ssl
attribute is set to False
in order to skip the Postgres level SSL protocol . pg8000 code
For PyMySQL driver, we create the connection ahead of time, wrap it with our own SSL config, and pass it to the driver.
Would either of these options be suitable for asyncpg? Happy to provide more information or assist on this if needed. Thanks so much!