Skip to content

Support for passing in connection arg or existing SSL connection to asyncpg.connect() #906

Closed
@jackwotherspoon

Description

@jackwotherspoon

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions