cloud-sql-python-connector


Namecloud-sql-python-connector JSON
Version 1.13.0 PyPI version JSON
download
home_pagehttps://github.com/GoogleCloudPlatform/cloud-sql-python-connector
SummaryThe Cloud SQL Python Connector is a library that can be used alongside a database driver to allow users with sufficient permissions to connect to a Cloud SQL database without having to manually allowlist IPs or manage SSL certificates.
upload_time2024-10-22 19:02:36
maintainerNone
docs_urlNone
authorGoogle LLC
requires_python>=3.9
licenseApache 2.0
keywords
VCS
bugtrack_url
requirements aiofiles aiohttp cryptography Requests google-auth
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
    <a href="https://cloud.google.com/blog/topics/developers-practitioners/how-connect-cloud-sql-using-python-easy-way">
        <img src="https://raw.githubusercontent.com/GoogleCloudPlatform/cloud-sql-python-connector/main/docs/images/cloud-sql-python-connector.png" alt="cloud-sql-python-connector image">
    </a>
</p>

<h1 align="center">Cloud SQL Python Connector</h1>

[![Open In Colab][colab-badge]][colab-notebook]
[![CI][ci-badge]][ci-build]
[![pypi][pypi-badge]][pypi-docs]
[![PyPI download month][pypi-downloads]][pypi-docs]
[![python][python-versions]][pypi-docs]

[colab-badge]: https://colab.research.google.com/assets/colab-badge.svg
[colab-notebook]: https://colab.research.google.com/github/GoogleCloudPlatform/cloud-sql-python-connector/blob/main/samples/notebooks/postgres_python_connector.ipynb
[ci-badge]: https://github.com/GoogleCloudPlatform/cloud-sql-python-connector/actions/workflows/tests.yml/badge.svg?event=push
[ci-build]: https://github.com/GoogleCloudPlatform/cloud-sql-python-connector/actions/workflows/tests.yml?query=event%3Apush+branch%3Amain
[pypi-badge]: https://img.shields.io/pypi/v/cloud-sql-python-connector
[pypi-docs]: https://pypi.org/project/cloud-sql-python-connector
[pypi-downloads]: https://img.shields.io/pypi/dm/cloud-sql-python-connector.svg
[python-versions]: https://img.shields.io/pypi/pyversions/cloud-sql-python-connector

The _Cloud SQL Python Connector_ is a Cloud SQL connector designed for use with the
Python language. Using a Cloud SQL connector provides a native alternative to the
[Cloud SQL Auth Proxy](https://cloud.google.com/sql/docs/mysql/sql-proxy) while
providing the following benefits:

* **IAM Authorization:** uses IAM permissions to control who/what can connect to
  your Cloud SQL instances
* **Improved Security:** uses robust, updated TLS 1.3 encryption and
  identity verification between the client connector and the server-side proxy,
  independent of the database protocol.
* **Convenience:** removes the requirement to use and distribute SSL
  certificates, as well as manage firewalls or source/destination IP addresses.
* (optionally) **IAM DB Authentication:** provides support for
  [Cloud SQL’s automatic IAM DB AuthN][iam-db-authn] feature.

[iam-db-authn]: https://cloud.google.com/sql/docs/postgres/authentication

The Cloud SQL Python Connector is a package to be used alongside a database driver.
Currently supported drivers are:
 - [`pymysql`](https://github.com/PyMySQL/PyMySQL) (MySQL)
 - [`pg8000`](https://github.com/tlocke/pg8000) (PostgreSQL)
 - [`asyncpg`](https://github.com/MagicStack/asyncpg) (PostgreSQL)
 - [`pytds`](https://github.com/denisenkom/pytds) (SQL Server)


## Installation

You can install this library with `pip install`, specifying the driver
based on your database dialect.

### MySQL
```
pip install "cloud-sql-python-connector[pymysql]"
```
### Postgres
There are two different database drivers that are supported for the Postgres dialect:

#### pg8000
```
pip install "cloud-sql-python-connector[pg8000]"
```
#### asyncpg
```
pip install "cloud-sql-python-connector[asyncpg]"
```
### SQL Server
```
pip install "cloud-sql-python-connector[pytds]"
```

### APIs and Services

This package requires the following to successfully make Cloud SQL Connections:

- IAM principal (user, service account, etc.) with the
[Cloud SQL Client][client-role] role. This IAM principal will be used for
[credentials](#credentials).
- The [Cloud SQL Admin API][admin-api] to be enabled within your Google Cloud
Project. By default, the API will be called in the project associated with
the IAM principal.

[admin-api]: https://console.cloud.google.com/apis/api/sqladmin.googleapis.com
[client-role]: https://cloud.google.com/sql/docs/mysql/roles-and-permissions

### Credentials

This library uses the [Application Default Credentials (ADC)][adc] strategy for
resolving credentials. Please see [these instructions for how to set your ADC][set-adc]
(Google Cloud Application vs Local Development, IAM user vs service account credentials),
or consult the [google.auth][google-auth] package.

To explicitly set a specific source for the credentials, see
[Configuring the Connector](#configuring-the-connector) below.

[adc]: https://cloud.google.com/docs/authentication#adc
[set-adc]: https://cloud.google.com/docs/authentication/provide-credentials-adc
[google-auth]: https://google-auth.readthedocs.io/en/master/reference/google.auth.html

## Usage

This package provides several functions for authorizing and encrypting
connections. These functions are used with your database driver to connect to
your Cloud SQL instance.

The instance connection name for your Cloud SQL instance is always in the
format "project:region:instance".

### How to use this Connector

To connect to Cloud SQL using the connector, inititalize a `Connector`
object and call its `connect` method with the proper input parameters.

The `Connector` itself creates connection objects by calling its `connect` method but does not manage database connection pooling. For this reason, it is recommended to use the connector alongside a library that can create connection pools, such as [SQLAlchemy](https://www.sqlalchemy.org/). This will allow for connections to remain open and be reused, reducing connection overhead and the number of connections needed.

In the Connector's `connect` method below, input your connection string as the first positional argument and the name of the database driver for the second positional argument. Insert the rest of your connection keyword arguments like user, password and database. You can also set the optional `timeout` or `ip_type` keyword arguments.

To use this connector with SQLAlchemy, use the `creator` argument for `sqlalchemy.create_engine`:

```python
from google.cloud.sql.connector import Connector
import sqlalchemy

# initialize Connector object
connector = Connector()

# function to return the database connection
def getconn() -> pymysql.connections.Connection:
    conn: pymysql.connections.Connection = connector.connect(
        "project:region:instance",
        "pymysql",
        user="my-user",
        password="my-password",
        db="my-db-name"
    )
    return conn

# create connection pool
pool = sqlalchemy.create_engine(
    "mysql+pymysql://",
    creator=getconn,
)
```

The returned connection pool engine can then be used to query and modify the database.

```python
# insert statement
insert_stmt = sqlalchemy.text(
    "INSERT INTO my_table (id, title) VALUES (:id, :title)",
)

with pool.connect() as db_conn:
    # insert into database
    db_conn.execute(insert_stmt, parameters={"id": "book1", "title": "Book One"})

    # query database
    result = db_conn.execute(sqlalchemy.text("SELECT * from my_table")).fetchall()

    # commit transaction (SQLAlchemy v2.X.X is commit as you go)
    db_conn.commit()

    # Do something with the results
    for row in result:
        print(row)
```

To close the `Connector` object's background resources, call its `close()` method as follows:

```python
connector.close()
```

> [!NOTE]
>
> For more examples of using SQLAlchemy to manage connection pooling with the connector,
> please see [Cloud SQL SQLAlchemy Samples](https://cloud.google.com/sql/docs/postgres/connect-connectors#python_1).

### Configuring the Connector

If you need to customize something about the connector, or want to specify
defaults for each connection to make, you can initialize a
`Connector` object as follows:

```python
from google.cloud.sql.connector import Connector

# Note: all parameters below are optional
connector = Connector(
    ip_type="public",  # can also be "private" or "psc"
    enable_iam_auth=False,
    timeout=30,
    credentials=custom_creds, # google.auth.credentials.Credentials
    refresh_strategy="lazy",  # can be "lazy" or "background"
)
```

### Using Connector as a Context Manager

The `Connector` object can also be used as a context manager in order to
automatically close and cleanup resources, removing the need for explicit
calls to `connector.close()`.

Connector as a context manager:

```python
from google.cloud.sql.connector import Connector
import pymysql
import sqlalchemy

# helper function to return SQLAlchemy connection pool
def init_connection_pool(connector: Connector) -> sqlalchemy.engine.Engine:
    # function used to generate database connection
    def getconn() -> pymysql.connections.Connection:
        conn = connector.connect(
            "project:region:instance",
            "pymysql",
            user="my-user",
            password="my-password",
            db="my-db-name"
        )
        return conn

    # create connection pool
    pool = sqlalchemy.create_engine(
        "mysql+pymysql://",
        creator=getconn,
    )
    return pool

# initialize Cloud SQL Python Connector as context manager
with Connector() as connector:
    # initialize connection pool
    pool = init_connection_pool(connector)
    # insert statement
    insert_stmt = sqlalchemy.text(
        "INSERT INTO my_table (id, title) VALUES (:id, :title)",
    )

    # interact with Cloud SQL database using connection pool
    with pool.connect() as db_conn:
        # insert into database
        db_conn.execute(insert_stmt, parameters={"id": "book1", "title": "Book One"})

        # commit transaction (SQLAlchemy v2.X.X is commit as you go)
        db_conn.commit()

        # query database
        result = db_conn.execute(sqlalchemy.text("SELECT * from my_table")).fetchall()

        # Do something with the results
        for row in result:
            print(row)
```

### Configuring a Lazy Refresh (Cloud Run, Cloud Functions etc.)

The Connector's `refresh_strategy` argument can be set to `"lazy"` to configure
the Python Connector to retrieve connection info lazily and as-needed.
Otherwise, a background refresh cycle runs to retrive the connection info
periodically. This setting is useful in environments where the CPU may be
throttled outside of a request context, e.g., Cloud Run, Cloud Functions, etc.

To set the refresh strategy, set the `refresh_strategy` keyword argument when
initializing a `Connector`:

```python
connector = Connector(refresh_strategy="lazy")
```

### Specifying IP Address Type

The Cloud SQL Python Connector can be used to connect to Cloud SQL instances
using both public and private IP addresses, as well as
[Private Service Connect][psc] (PSC). To specify which IP address type to connect
with, set the `ip_type` keyword argument when initializing a `Connector()` or when
calling `connector.connect()`.

Possible values for `ip_type` are `"public"` (default value),
`"private"`, and `"psc"`.

Example:

```python
conn = connector.connect(
    "project:region:instance",
    "pymysql",
    ip_type="private"  # use private IP
... insert other kwargs ...
)
```

> [!IMPORTANT]
>
> If specifying Private IP or Private Service Connect (PSC), your application must be
> attached to the proper VPC network to connect to your Cloud SQL instance. For most
> applications this will require the use of a [VPC Connector][vpc-connector].

[psc]: https://cloud.google.com/vpc/docs/private-service-connect
[vpc-connector]: https://cloud.google.com/vpc/docs/configure-serverless-vpc-access#create-connector

### Automatic IAM Database Authentication

Connections using [Automatic IAM database authentication](https://cloud.google.com/sql/docs/postgres/authentication#automatic) are supported when using Postgres or MySQL drivers.
First, make sure to [configure your Cloud SQL Instance to allow IAM authentication](https://cloud.google.com/sql/docs/postgres/create-edit-iam-instances#configure-iam-db-instance)
and [add an IAM database user](https://cloud.google.com/sql/docs/postgres/create-manage-iam-users#creating-a-database-user).

Now, you can connect using user or service account credentials instead of a password.
In the call to connect, set the `enable_iam_auth` keyword argument to true and the `user` argument to the appropriately formatted IAM principal.
> Postgres: For an IAM user account, this is the user's email address. For a service account, it is the service account's email without the `.gserviceaccount.com` domain suffix.

> MySQL: For an IAM user account, this is the user's email address, without the @ or domain name. For example, for `test-user@gmail.com`, set the `user` argument to `test-user`. For a service account, this is the service account's email address without the `@project-id.iam.gserviceaccount.com` suffix.

Example:

```python
conn = connector.connect(
     "project:region:instance",
     "pg8000",
     user="postgres-iam-user@gmail.com",
     db="my-db-name",
     enable_iam_auth=True,
 )
```

### SQL Server (MSSQL)

> [!IMPORTANT]
>
> If your SQL Server instance is set to [enforce SSL connections](https://cloud.google.com/sql/docs/sqlserver/configure-ssl-instance#enforcing-ssl),
> you need to download the CA certificate for your instance and include `cafile={path to downloaded certificate}`
> and `validate_host=False`. This is a workaround for a [known issue](https://issuetracker.google.com/184867147).

#### Active Directory Authentication

Active Directory authentication for SQL Server instances is currently only supported on Windows.
First, make sure to follow [these steps](https://cloud.google.com/blog/topics/developers-practitioners/creating-sql-server-instance-integrated-active-directory-using-google-cloud-sql)
to set up a Managed AD domain and join your Cloud SQL instance to the domain.
[See here for more info on Cloud SQL Active Directory integration](https://cloud.google.com/sql/docs/sqlserver/ad).

Once you have followed the steps linked above, you can run the following code to return a connection object:

```python
conn = connector.connect(
    "project:region:instance",
    "pytds",
    db="my-db-name",
    active_directory_auth=True,
    server_name="public.[instance].[location].[project].cloudsql.[domain]",
)
```

Or, if using Private IP:

```python
conn = connector.connect(
    "project:region:instance",
    "pytds",
    db="my-db-name",
    active_directory_auth=True,
    server_name="private.[instance].[location].[project].cloudsql.[domain]",
    ip_type="private"
)
```

### Using the Python Connector with Python Web Frameworks

The Python Connector can be used alongside popular Python web frameworks such
as Flask, FastAPI, etc, to integrate Cloud SQL databases within your
web applications.

> [!NOTE]
>
> For serverless environments such as Cloud Functions, Cloud Run, etc, it may be
> beneficial to initialize the `Connector` with the lazy refresh strategy.
> i.e. `Connector(refresh_strategy="lazy")`
>
> See [Configuring a Lazy Refresh](#configuring-a-lazy-refresh-cloud-run-cloud-functions-etc)

#### Flask-SQLAlchemy

[Flask-SQLAlchemy](https://flask-sqlalchemy.palletsprojects.com/en/2.x/)
is an extension for [Flask](https://flask.palletsprojects.com/en/2.2.x/)
that adds support for [SQLAlchemy](https://www.sqlalchemy.org/) to your
application. It aims to simplify using SQLAlchemy with Flask by providing
useful defaults and extra helpers that make it easier to accomplish
common tasks.

You can configure Flask-SQLAlchemy to connect to a Cloud SQL database from
your web application through the following:

```python
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from google.cloud.sql.connector import Connector


# initialize Python Connector object
connector = Connector()

# Python Connector database connection function
def getconn():
    conn = connector.connect(
        "project:region:instance-name", # Cloud SQL Instance Connection Name
        "pg8000",
        user="my-user",
        password="my-password",
        db="my-database",
        ip_type="public"  # "private" for private IP
    )
    return conn


app = Flask(__name__)

# configure Flask-SQLAlchemy to use Python Connector
app.config['SQLALCHEMY_DATABASE_URI'] = "postgresql+pg8000://"
app.config['SQLALCHEMY_ENGINE_OPTIONS'] = {
    "creator": getconn
}

# initialize the app with the extension
db = SQLAlchemy()
db.init_app(app)
```

For more details on how to use Flask-SQLAlchemy, check out the
[Flask-SQLAlchemy Quickstarts](https://flask-sqlalchemy.palletsprojects.com/en/3.0.x/quickstart/)

#### FastAPI

[FastAPI](https://fastapi.tiangolo.com/) is a modern, fast (high-performance),
web framework for building APIs with Python based on standard Python type hints.

You can configure FastAPI to connect to a Cloud SQL database from
your web application using [SQLAlchemy ORM](https://docs.sqlalchemy.org/en/14/orm/)
through the following:

```python
from sqlalchemy import create_engine
from sqlalchemy.engine import Engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from google.cloud.sql.connector import Connector

# helper function to return SQLAlchemy connection pool
def init_connection_pool(connector: Connector) -> Engine:
    # Python Connector database connection function
    def getconn():
        conn = connector.connect(
            "project:region:instance-name", # Cloud SQL Instance Connection Name
            "pg8000",
            user="my-user",
            password="my-password",
            db="my-database",
            ip_type="public"  # "private" for private IP
        )
        return conn

    SQLALCHEMY_DATABASE_URL = "postgresql+pg8000://"

    engine = create_engine(
        SQLALCHEMY_DATABASE_URL , creator=getconn
    )
    return engine

# initialize Cloud SQL Python Connector
connector = Connector()

# create connection pool engine
engine = init_connection_pool(connector)

# create SQLAlchemy ORM session
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)

Base = declarative_base()
```

To learn more about integrating a database into your FastAPI application,
follow along the [FastAPI SQL Database guide](https://fastapi.tiangolo.com/tutorial/sql-databases/#create-the-database-models).

### Async Driver Usage

The Cloud SQL Connector is compatible with
[asyncio](https://docs.python.org/3/library/asyncio.html) to improve the speed
and efficiency of database connections through concurrency. You can use all
non-asyncio drivers through the `Connector.connect_async` function, in addition
to the following asyncio database drivers:
- [asyncpg](https://magicstack.github.io/asyncpg) (Postgres)

The Cloud SQL Connector has a helper `create_async_connector` function that is
recommended for asyncio database connections. It returns a `Connector`
object that uses the current thread's running event loop. This is different
than `Connector()` which by default initializes a new event loop in a
background thread.

The `create_async_connector` allows all the same input arguments as the
[Connector](#configuring-the-connector) object.

Once a `Connector` object is returned by `create_async_connector` you can call
its `connect_async` method, just as you would the `connect` method:

```python
import asyncpg

import sqlalchemy
from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine

from google.cloud.sql.connector import Connector, create_async_connector

async def init_connection_pool(connector: Connector) -> AsyncEngine:
    # initialize Connector object for connections to Cloud SQL
    async def getconn() -> asyncpg.Connection:
        conn: asyncpg.Connection = await connector.connect_async(
            "project:region:instance",  # Cloud SQL instance connection name
            "asyncpg",
            user="my-user",
            password="my-password",
            db="my-db-name"
            # ... additional database driver args
        )
        return conn

    # The Cloud SQL Python Connector can be used along with SQLAlchemy using the
    # 'async_creator' argument to 'create_async_engine'
    pool = create_async_engine(
        "postgresql+asyncpg://",
        async_creator=getconn,
    )
    return pool

async def main():
    # initialize Connector object for connections to Cloud SQL
    connector = await create_async_connector()

    # initialize connection pool
    pool = await init_connection_pool(connector)

    # example query
    async with pool.connect() as conn:
        await conn.execute(sqlalchemy.text("SELECT NOW()"))

    # close Connector
    await connector.close_async()

    # dispose of connection pool
    await pool.dispose()
```

For more details on additional database arguments with an `asyncpg.Connection`
, please visit the
[official documentation](https://magicstack.github.io/asyncpg/current/api/index.html).

### Async Context Manager

An alternative to using the `create_async_connector` function is initializing
a `Connector` as an async context manager, removing the need for explicit
calls to `connector.close_async()` to cleanup resources.

> [!NOTE]
>
> This alternative requires that the running event loop be
> passed in as the `loop` argument to `Connector()`.

```python
import asyncio
import asyncpg

import sqlalchemy
from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine

from google.cloud.sql.connector import Connector

async def init_connection_pool(connector: Connector) -> AsyncEngine:
    # initialize Connector object for connections to Cloud SQL
    async def getconn() -> asyncpg.Connection:
            conn: asyncpg.Connection = await connector.connect_async(
                "project:region:instance",  # Cloud SQL instance connection name
                "asyncpg",
                user="my-user",
                password="my-password",
                db="my-db-name"
                # ... additional database driver args
            )
            return conn

    # The Cloud SQL Python Connector can be used along with SQLAlchemy using the
    # 'async_creator' argument to 'create_async_engine'
    pool = create_async_engine(
        "postgresql+asyncpg://",
        async_creator=getconn,
    )
    return pool

async def main():
    # initialize Connector object for connections to Cloud SQL
    loop = asyncio.get_running_loop()
    async with Connector(loop=loop) as connector:
        # initialize connection pool
        pool = await init_connection_pool(connector)

        # example query
        async with pool.connect() as conn:
            await conn.execute(sqlalchemy.text("SELECT NOW()"))

        # dispose of connection pool
        await pool.dispose()
```

### Debug Logging

The Cloud SQL Python Connector uses the standard [Python logging module][python-logging]
for debug logging support.

Add the below code to your application to enable debug logging with the Cloud SQL
Python Connector:

```python
import logging

logging.basicConfig(format="%(asctime)s [%(levelname)s]: %(message)s")
logger = logging.getLogger(name="google.cloud.sql.connector")
logger.setLevel(logging.DEBUG)
```

For more details on configuring logging, please refer to the
[Python logging docs][configure-logging].

[python-logging]: https://docs.python.org/3/library/logging.html
[configure-logging]: https://docs.python.org/3/howto/logging.html#configuring-logging

## Support policy

### Major version lifecycle

This project uses [semantic versioning](https://semver.org/), and uses the
following lifecycle regarding support for a major version:

**Active** - Active versions get all new features and security fixes (that
wouldn’t otherwise introduce a breaking change). New major versions are
guaranteed to be "active" for a minimum of 1 year.
**Deprecated** - Deprecated versions continue to receive security and critical
bug fixes, but do not receive new features. Deprecated versions will be publicly
supported for 1 year.
**Unsupported** - Any major version that has been deprecated for >=1 year is
considered publicly unsupported.

### Supported Python Versions

We follow the [Python Version Support Policy][pyver] used by Google Cloud
Libraries for Python. Changes in supported Python versions will be
considered a minor change, and will be listed in the release notes.

[pyver]: https://cloud.google.com/python/docs/supported-python-versions

### Release cadence
This project aims for a minimum monthly release cadence. If no new
features or fixes have been added, a new PATCH version with the latest
dependencies is released.

### Contributing

We welcome outside contributions. Please see our
[Contributing Guide](CONTRIBUTING.md) for details on how best to contribute.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/GoogleCloudPlatform/cloud-sql-python-connector",
    "name": "cloud-sql-python-connector",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Google LLC",
    "author_email": "googleapis-packages@google.com",
    "download_url": "https://files.pythonhosted.org/packages/9d/55/6f0d510cc2ef5bd2b8ed1811e9f68108f4d3c1512b73029856a0678eccb4/cloud_sql_python_connector-1.13.0.tar.gz",
    "platform": "Posix; MacOS X; Windows",
    "description": "<p align=\"center\">\n    <a href=\"https://cloud.google.com/blog/topics/developers-practitioners/how-connect-cloud-sql-using-python-easy-way\">\n        <img src=\"https://raw.githubusercontent.com/GoogleCloudPlatform/cloud-sql-python-connector/main/docs/images/cloud-sql-python-connector.png\" alt=\"cloud-sql-python-connector image\">\n    </a>\n</p>\n\n<h1 align=\"center\">Cloud SQL Python Connector</h1>\n\n[![Open In Colab][colab-badge]][colab-notebook]\n[![CI][ci-badge]][ci-build]\n[![pypi][pypi-badge]][pypi-docs]\n[![PyPI download month][pypi-downloads]][pypi-docs]\n[![python][python-versions]][pypi-docs]\n\n[colab-badge]: https://colab.research.google.com/assets/colab-badge.svg\n[colab-notebook]: https://colab.research.google.com/github/GoogleCloudPlatform/cloud-sql-python-connector/blob/main/samples/notebooks/postgres_python_connector.ipynb\n[ci-badge]: https://github.com/GoogleCloudPlatform/cloud-sql-python-connector/actions/workflows/tests.yml/badge.svg?event=push\n[ci-build]: https://github.com/GoogleCloudPlatform/cloud-sql-python-connector/actions/workflows/tests.yml?query=event%3Apush+branch%3Amain\n[pypi-badge]: https://img.shields.io/pypi/v/cloud-sql-python-connector\n[pypi-docs]: https://pypi.org/project/cloud-sql-python-connector\n[pypi-downloads]: https://img.shields.io/pypi/dm/cloud-sql-python-connector.svg\n[python-versions]: https://img.shields.io/pypi/pyversions/cloud-sql-python-connector\n\nThe _Cloud SQL Python Connector_ is a Cloud SQL connector designed for use with the\nPython language. Using a Cloud SQL connector provides a native alternative to the\n[Cloud SQL Auth Proxy](https://cloud.google.com/sql/docs/mysql/sql-proxy) while\nproviding the following benefits:\n\n* **IAM Authorization:** uses IAM permissions to control who/what can connect to\n  your Cloud SQL instances\n* **Improved Security:** uses robust, updated TLS 1.3 encryption and\n  identity verification between the client connector and the server-side proxy,\n  independent of the database protocol.\n* **Convenience:** removes the requirement to use and distribute SSL\n  certificates, as well as manage firewalls or source/destination IP addresses.\n* (optionally) **IAM DB Authentication:** provides support for\n  [Cloud SQL\u2019s automatic IAM DB AuthN][iam-db-authn] feature.\n\n[iam-db-authn]: https://cloud.google.com/sql/docs/postgres/authentication\n\nThe Cloud SQL Python Connector is a package to be used alongside a database driver.\nCurrently supported drivers are:\n - [`pymysql`](https://github.com/PyMySQL/PyMySQL) (MySQL)\n - [`pg8000`](https://github.com/tlocke/pg8000) (PostgreSQL)\n - [`asyncpg`](https://github.com/MagicStack/asyncpg) (PostgreSQL)\n - [`pytds`](https://github.com/denisenkom/pytds) (SQL Server)\n\n\n## Installation\n\nYou can install this library with `pip install`, specifying the driver\nbased on your database dialect.\n\n### MySQL\n```\npip install \"cloud-sql-python-connector[pymysql]\"\n```\n### Postgres\nThere are two different database drivers that are supported for the Postgres dialect:\n\n#### pg8000\n```\npip install \"cloud-sql-python-connector[pg8000]\"\n```\n#### asyncpg\n```\npip install \"cloud-sql-python-connector[asyncpg]\"\n```\n### SQL Server\n```\npip install \"cloud-sql-python-connector[pytds]\"\n```\n\n### APIs and Services\n\nThis package requires the following to successfully make Cloud SQL Connections:\n\n- IAM principal (user, service account, etc.) with the\n[Cloud SQL Client][client-role] role. This IAM principal will be used for\n[credentials](#credentials).\n- The [Cloud SQL Admin API][admin-api] to be enabled within your Google Cloud\nProject. By default, the API will be called in the project associated with\nthe IAM principal.\n\n[admin-api]: https://console.cloud.google.com/apis/api/sqladmin.googleapis.com\n[client-role]: https://cloud.google.com/sql/docs/mysql/roles-and-permissions\n\n### Credentials\n\nThis library uses the [Application Default Credentials (ADC)][adc] strategy for\nresolving credentials. Please see [these instructions for how to set your ADC][set-adc]\n(Google Cloud Application vs Local Development, IAM user vs service account credentials),\nor consult the [google.auth][google-auth] package.\n\nTo explicitly set a specific source for the credentials, see\n[Configuring the Connector](#configuring-the-connector) below.\n\n[adc]: https://cloud.google.com/docs/authentication#adc\n[set-adc]: https://cloud.google.com/docs/authentication/provide-credentials-adc\n[google-auth]: https://google-auth.readthedocs.io/en/master/reference/google.auth.html\n\n## Usage\n\nThis package provides several functions for authorizing and encrypting\nconnections. These functions are used with your database driver to connect to\nyour Cloud SQL instance.\n\nThe instance connection name for your Cloud SQL instance is always in the\nformat \"project:region:instance\".\n\n### How to use this Connector\n\nTo connect to Cloud SQL using the connector, inititalize a `Connector`\nobject and call its `connect` method with the proper input parameters.\n\nThe `Connector` itself creates connection objects by calling its `connect` method but does not manage database connection pooling. For this reason, it is recommended to use the connector alongside a library that can create connection pools, such as [SQLAlchemy](https://www.sqlalchemy.org/). This will allow for connections to remain open and be reused, reducing connection overhead and the number of connections needed.\n\nIn the Connector's `connect` method below, input your connection string as the first positional argument and the name of the database driver for the second positional argument. Insert the rest of your connection keyword arguments like user, password and database. You can also set the optional `timeout` or `ip_type` keyword arguments.\n\nTo use this connector with SQLAlchemy, use the `creator` argument for `sqlalchemy.create_engine`:\n\n```python\nfrom google.cloud.sql.connector import Connector\nimport sqlalchemy\n\n# initialize Connector object\nconnector = Connector()\n\n# function to return the database connection\ndef getconn() -> pymysql.connections.Connection:\n    conn: pymysql.connections.Connection = connector.connect(\n        \"project:region:instance\",\n        \"pymysql\",\n        user=\"my-user\",\n        password=\"my-password\",\n        db=\"my-db-name\"\n    )\n    return conn\n\n# create connection pool\npool = sqlalchemy.create_engine(\n    \"mysql+pymysql://\",\n    creator=getconn,\n)\n```\n\nThe returned connection pool engine can then be used to query and modify the database.\n\n```python\n# insert statement\ninsert_stmt = sqlalchemy.text(\n    \"INSERT INTO my_table (id, title) VALUES (:id, :title)\",\n)\n\nwith pool.connect() as db_conn:\n    # insert into database\n    db_conn.execute(insert_stmt, parameters={\"id\": \"book1\", \"title\": \"Book One\"})\n\n    # query database\n    result = db_conn.execute(sqlalchemy.text(\"SELECT * from my_table\")).fetchall()\n\n    # commit transaction (SQLAlchemy v2.X.X is commit as you go)\n    db_conn.commit()\n\n    # Do something with the results\n    for row in result:\n        print(row)\n```\n\nTo close the `Connector` object's background resources, call its `close()` method as follows:\n\n```python\nconnector.close()\n```\n\n> [!NOTE]\n>\n> For more examples of using SQLAlchemy to manage connection pooling with the connector,\n> please see [Cloud SQL SQLAlchemy Samples](https://cloud.google.com/sql/docs/postgres/connect-connectors#python_1).\n\n### Configuring the Connector\n\nIf you need to customize something about the connector, or want to specify\ndefaults for each connection to make, you can initialize a\n`Connector` object as follows:\n\n```python\nfrom google.cloud.sql.connector import Connector\n\n# Note: all parameters below are optional\nconnector = Connector(\n    ip_type=\"public\",  # can also be \"private\" or \"psc\"\n    enable_iam_auth=False,\n    timeout=30,\n    credentials=custom_creds, # google.auth.credentials.Credentials\n    refresh_strategy=\"lazy\",  # can be \"lazy\" or \"background\"\n)\n```\n\n### Using Connector as a Context Manager\n\nThe `Connector` object can also be used as a context manager in order to\nautomatically close and cleanup resources, removing the need for explicit\ncalls to `connector.close()`.\n\nConnector as a context manager:\n\n```python\nfrom google.cloud.sql.connector import Connector\nimport pymysql\nimport sqlalchemy\n\n# helper function to return SQLAlchemy connection pool\ndef init_connection_pool(connector: Connector) -> sqlalchemy.engine.Engine:\n    # function used to generate database connection\n    def getconn() -> pymysql.connections.Connection:\n        conn = connector.connect(\n            \"project:region:instance\",\n            \"pymysql\",\n            user=\"my-user\",\n            password=\"my-password\",\n            db=\"my-db-name\"\n        )\n        return conn\n\n    # create connection pool\n    pool = sqlalchemy.create_engine(\n        \"mysql+pymysql://\",\n        creator=getconn,\n    )\n    return pool\n\n# initialize Cloud SQL Python Connector as context manager\nwith Connector() as connector:\n    # initialize connection pool\n    pool = init_connection_pool(connector)\n    # insert statement\n    insert_stmt = sqlalchemy.text(\n        \"INSERT INTO my_table (id, title) VALUES (:id, :title)\",\n    )\n\n    # interact with Cloud SQL database using connection pool\n    with pool.connect() as db_conn:\n        # insert into database\n        db_conn.execute(insert_stmt, parameters={\"id\": \"book1\", \"title\": \"Book One\"})\n\n        # commit transaction (SQLAlchemy v2.X.X is commit as you go)\n        db_conn.commit()\n\n        # query database\n        result = db_conn.execute(sqlalchemy.text(\"SELECT * from my_table\")).fetchall()\n\n        # Do something with the results\n        for row in result:\n            print(row)\n```\n\n### Configuring a Lazy Refresh (Cloud Run, Cloud Functions etc.)\n\nThe Connector's `refresh_strategy` argument can be set to `\"lazy\"` to configure\nthe Python Connector to retrieve connection info lazily and as-needed.\nOtherwise, a background refresh cycle runs to retrive the connection info\nperiodically. This setting is useful in environments where the CPU may be\nthrottled outside of a request context, e.g., Cloud Run, Cloud Functions, etc.\n\nTo set the refresh strategy, set the `refresh_strategy` keyword argument when\ninitializing a `Connector`:\n\n```python\nconnector = Connector(refresh_strategy=\"lazy\")\n```\n\n### Specifying IP Address Type\n\nThe Cloud SQL Python Connector can be used to connect to Cloud SQL instances\nusing both public and private IP addresses, as well as\n[Private Service Connect][psc] (PSC). To specify which IP address type to connect\nwith, set the `ip_type` keyword argument when initializing a `Connector()` or when\ncalling `connector.connect()`.\n\nPossible values for `ip_type` are `\"public\"` (default value),\n`\"private\"`, and `\"psc\"`.\n\nExample:\n\n```python\nconn = connector.connect(\n    \"project:region:instance\",\n    \"pymysql\",\n    ip_type=\"private\"  # use private IP\n... insert other kwargs ...\n)\n```\n\n> [!IMPORTANT]\n>\n> If specifying Private IP or Private Service Connect (PSC), your application must be\n> attached to the proper VPC network to connect to your Cloud SQL instance. For most\n> applications this will require the use of a [VPC Connector][vpc-connector].\n\n[psc]: https://cloud.google.com/vpc/docs/private-service-connect\n[vpc-connector]: https://cloud.google.com/vpc/docs/configure-serverless-vpc-access#create-connector\n\n### Automatic IAM Database Authentication\n\nConnections using [Automatic IAM database authentication](https://cloud.google.com/sql/docs/postgres/authentication#automatic) are supported when using Postgres or MySQL drivers.\nFirst, make sure to [configure your Cloud SQL Instance to allow IAM authentication](https://cloud.google.com/sql/docs/postgres/create-edit-iam-instances#configure-iam-db-instance)\nand [add an IAM database user](https://cloud.google.com/sql/docs/postgres/create-manage-iam-users#creating-a-database-user).\n\nNow, you can connect using user or service account credentials instead of a password.\nIn the call to connect, set the `enable_iam_auth` keyword argument to true and the `user` argument to the appropriately formatted IAM principal.\n> Postgres: For an IAM user account, this is the user's email address. For a service account, it is the service account's email without the `.gserviceaccount.com` domain suffix.\n\n> MySQL: For an IAM user account, this is the user's email address, without the @ or domain name. For example, for `test-user@gmail.com`, set the `user` argument to `test-user`. For a service account, this is the service account's email address without the `@project-id.iam.gserviceaccount.com` suffix.\n\nExample:\n\n```python\nconn = connector.connect(\n     \"project:region:instance\",\n     \"pg8000\",\n     user=\"postgres-iam-user@gmail.com\",\n     db=\"my-db-name\",\n     enable_iam_auth=True,\n )\n```\n\n### SQL Server (MSSQL)\n\n> [!IMPORTANT]\n>\n> If your SQL Server instance is set to [enforce SSL connections](https://cloud.google.com/sql/docs/sqlserver/configure-ssl-instance#enforcing-ssl),\n> you need to download the CA certificate for your instance and include `cafile={path to downloaded certificate}`\n> and `validate_host=False`. This is a workaround for a [known issue](https://issuetracker.google.com/184867147).\n\n#### Active Directory Authentication\n\nActive Directory authentication for SQL Server instances is currently only supported on Windows.\nFirst, make sure to follow [these steps](https://cloud.google.com/blog/topics/developers-practitioners/creating-sql-server-instance-integrated-active-directory-using-google-cloud-sql)\nto set up a Managed AD domain and join your Cloud SQL instance to the domain.\n[See here for more info on Cloud SQL Active Directory integration](https://cloud.google.com/sql/docs/sqlserver/ad).\n\nOnce you have followed the steps linked above, you can run the following code to return a connection object:\n\n```python\nconn = connector.connect(\n    \"project:region:instance\",\n    \"pytds\",\n    db=\"my-db-name\",\n    active_directory_auth=True,\n    server_name=\"public.[instance].[location].[project].cloudsql.[domain]\",\n)\n```\n\nOr, if using Private IP:\n\n```python\nconn = connector.connect(\n    \"project:region:instance\",\n    \"pytds\",\n    db=\"my-db-name\",\n    active_directory_auth=True,\n    server_name=\"private.[instance].[location].[project].cloudsql.[domain]\",\n    ip_type=\"private\"\n)\n```\n\n### Using the Python Connector with Python Web Frameworks\n\nThe Python Connector can be used alongside popular Python web frameworks such\nas Flask, FastAPI, etc, to integrate Cloud SQL databases within your\nweb applications.\n\n> [!NOTE]\n>\n> For serverless environments such as Cloud Functions, Cloud Run, etc, it may be\n> beneficial to initialize the `Connector` with the lazy refresh strategy.\n> i.e. `Connector(refresh_strategy=\"lazy\")`\n>\n> See [Configuring a Lazy Refresh](#configuring-a-lazy-refresh-cloud-run-cloud-functions-etc)\n\n#### Flask-SQLAlchemy\n\n[Flask-SQLAlchemy](https://flask-sqlalchemy.palletsprojects.com/en/2.x/)\nis an extension for [Flask](https://flask.palletsprojects.com/en/2.2.x/)\nthat adds support for [SQLAlchemy](https://www.sqlalchemy.org/) to your\napplication. It aims to simplify using SQLAlchemy with Flask by providing\nuseful defaults and extra helpers that make it easier to accomplish\ncommon tasks.\n\nYou can configure Flask-SQLAlchemy to connect to a Cloud SQL database from\nyour web application through the following:\n\n```python\nfrom flask import Flask\nfrom flask_sqlalchemy import SQLAlchemy\nfrom google.cloud.sql.connector import Connector\n\n\n# initialize Python Connector object\nconnector = Connector()\n\n# Python Connector database connection function\ndef getconn():\n    conn = connector.connect(\n        \"project:region:instance-name\", # Cloud SQL Instance Connection Name\n        \"pg8000\",\n        user=\"my-user\",\n        password=\"my-password\",\n        db=\"my-database\",\n        ip_type=\"public\"  # \"private\" for private IP\n    )\n    return conn\n\n\napp = Flask(__name__)\n\n# configure Flask-SQLAlchemy to use Python Connector\napp.config['SQLALCHEMY_DATABASE_URI'] = \"postgresql+pg8000://\"\napp.config['SQLALCHEMY_ENGINE_OPTIONS'] = {\n    \"creator\": getconn\n}\n\n# initialize the app with the extension\ndb = SQLAlchemy()\ndb.init_app(app)\n```\n\nFor more details on how to use Flask-SQLAlchemy, check out the\n[Flask-SQLAlchemy Quickstarts](https://flask-sqlalchemy.palletsprojects.com/en/3.0.x/quickstart/)\n\n#### FastAPI\n\n[FastAPI](https://fastapi.tiangolo.com/) is a modern, fast (high-performance),\nweb framework for building APIs with Python based on standard Python type hints.\n\nYou can configure FastAPI to connect to a Cloud SQL database from\nyour web application using [SQLAlchemy ORM](https://docs.sqlalchemy.org/en/14/orm/)\nthrough the following:\n\n```python\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.engine import Engine\nfrom sqlalchemy.ext.declarative import declarative_base\nfrom sqlalchemy.orm import sessionmaker\nfrom google.cloud.sql.connector import Connector\n\n# helper function to return SQLAlchemy connection pool\ndef init_connection_pool(connector: Connector) -> Engine:\n    # Python Connector database connection function\n    def getconn():\n        conn = connector.connect(\n            \"project:region:instance-name\", # Cloud SQL Instance Connection Name\n            \"pg8000\",\n            user=\"my-user\",\n            password=\"my-password\",\n            db=\"my-database\",\n            ip_type=\"public\"  # \"private\" for private IP\n        )\n        return conn\n\n    SQLALCHEMY_DATABASE_URL = \"postgresql+pg8000://\"\n\n    engine = create_engine(\n        SQLALCHEMY_DATABASE_URL , creator=getconn\n    )\n    return engine\n\n# initialize Cloud SQL Python Connector\nconnector = Connector()\n\n# create connection pool engine\nengine = init_connection_pool(connector)\n\n# create SQLAlchemy ORM session\nSessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)\n\nBase = declarative_base()\n```\n\nTo learn more about integrating a database into your FastAPI application,\nfollow along the [FastAPI SQL Database guide](https://fastapi.tiangolo.com/tutorial/sql-databases/#create-the-database-models).\n\n### Async Driver Usage\n\nThe Cloud SQL Connector is compatible with\n[asyncio](https://docs.python.org/3/library/asyncio.html) to improve the speed\nand efficiency of database connections through concurrency. You can use all\nnon-asyncio drivers through the `Connector.connect_async` function, in addition\nto the following asyncio database drivers:\n- [asyncpg](https://magicstack.github.io/asyncpg) (Postgres)\n\nThe Cloud SQL Connector has a helper `create_async_connector` function that is\nrecommended for asyncio database connections. It returns a `Connector`\nobject that uses the current thread's running event loop. This is different\nthan `Connector()` which by default initializes a new event loop in a\nbackground thread.\n\nThe `create_async_connector` allows all the same input arguments as the\n[Connector](#configuring-the-connector) object.\n\nOnce a `Connector` object is returned by `create_async_connector` you can call\nits `connect_async` method, just as you would the `connect` method:\n\n```python\nimport asyncpg\n\nimport sqlalchemy\nfrom sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine\n\nfrom google.cloud.sql.connector import Connector, create_async_connector\n\nasync def init_connection_pool(connector: Connector) -> AsyncEngine:\n    # initialize Connector object for connections to Cloud SQL\n    async def getconn() -> asyncpg.Connection:\n        conn: asyncpg.Connection = await connector.connect_async(\n            \"project:region:instance\",  # Cloud SQL instance connection name\n            \"asyncpg\",\n            user=\"my-user\",\n            password=\"my-password\",\n            db=\"my-db-name\"\n            # ... additional database driver args\n        )\n        return conn\n\n    # The Cloud SQL Python Connector can be used along with SQLAlchemy using the\n    # 'async_creator' argument to 'create_async_engine'\n    pool = create_async_engine(\n        \"postgresql+asyncpg://\",\n        async_creator=getconn,\n    )\n    return pool\n\nasync def main():\n    # initialize Connector object for connections to Cloud SQL\n    connector = await create_async_connector()\n\n    # initialize connection pool\n    pool = await init_connection_pool(connector)\n\n    # example query\n    async with pool.connect() as conn:\n        await conn.execute(sqlalchemy.text(\"SELECT NOW()\"))\n\n    # close Connector\n    await connector.close_async()\n\n    # dispose of connection pool\n    await pool.dispose()\n```\n\nFor more details on additional database arguments with an `asyncpg.Connection`\n, please visit the\n[official documentation](https://magicstack.github.io/asyncpg/current/api/index.html).\n\n### Async Context Manager\n\nAn alternative to using the `create_async_connector` function is initializing\na `Connector` as an async context manager, removing the need for explicit\ncalls to `connector.close_async()` to cleanup resources.\n\n> [!NOTE]\n>\n> This alternative requires that the running event loop be\n> passed in as the `loop` argument to `Connector()`.\n\n```python\nimport asyncio\nimport asyncpg\n\nimport sqlalchemy\nfrom sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine\n\nfrom google.cloud.sql.connector import Connector\n\nasync def init_connection_pool(connector: Connector) -> AsyncEngine:\n    # initialize Connector object for connections to Cloud SQL\n    async def getconn() -> asyncpg.Connection:\n            conn: asyncpg.Connection = await connector.connect_async(\n                \"project:region:instance\",  # Cloud SQL instance connection name\n                \"asyncpg\",\n                user=\"my-user\",\n                password=\"my-password\",\n                db=\"my-db-name\"\n                # ... additional database driver args\n            )\n            return conn\n\n    # The Cloud SQL Python Connector can be used along with SQLAlchemy using the\n    # 'async_creator' argument to 'create_async_engine'\n    pool = create_async_engine(\n        \"postgresql+asyncpg://\",\n        async_creator=getconn,\n    )\n    return pool\n\nasync def main():\n    # initialize Connector object for connections to Cloud SQL\n    loop = asyncio.get_running_loop()\n    async with Connector(loop=loop) as connector:\n        # initialize connection pool\n        pool = await init_connection_pool(connector)\n\n        # example query\n        async with pool.connect() as conn:\n            await conn.execute(sqlalchemy.text(\"SELECT NOW()\"))\n\n        # dispose of connection pool\n        await pool.dispose()\n```\n\n### Debug Logging\n\nThe Cloud SQL Python Connector uses the standard [Python logging module][python-logging]\nfor debug logging support.\n\nAdd the below code to your application to enable debug logging with the Cloud SQL\nPython Connector:\n\n```python\nimport logging\n\nlogging.basicConfig(format=\"%(asctime)s [%(levelname)s]: %(message)s\")\nlogger = logging.getLogger(name=\"google.cloud.sql.connector\")\nlogger.setLevel(logging.DEBUG)\n```\n\nFor more details on configuring logging, please refer to the\n[Python logging docs][configure-logging].\n\n[python-logging]: https://docs.python.org/3/library/logging.html\n[configure-logging]: https://docs.python.org/3/howto/logging.html#configuring-logging\n\n## Support policy\n\n### Major version lifecycle\n\nThis project uses [semantic versioning](https://semver.org/), and uses the\nfollowing lifecycle regarding support for a major version:\n\n**Active** - Active versions get all new features and security fixes (that\nwouldn\u2019t otherwise introduce a breaking change). New major versions are\nguaranteed to be \"active\" for a minimum of 1 year.\n**Deprecated** - Deprecated versions continue to receive security and critical\nbug fixes, but do not receive new features. Deprecated versions will be publicly\nsupported for 1 year.\n**Unsupported** - Any major version that has been deprecated for >=1 year is\nconsidered publicly unsupported.\n\n### Supported Python Versions\n\nWe follow the [Python Version Support Policy][pyver] used by Google Cloud\nLibraries for Python. Changes in supported Python versions will be\nconsidered a minor change, and will be listed in the release notes.\n\n[pyver]: https://cloud.google.com/python/docs/supported-python-versions\n\n### Release cadence\nThis project aims for a minimum monthly release cadence. If no new\nfeatures or fixes have been added, a new PATCH version with the latest\ndependencies is released.\n\n### Contributing\n\nWe welcome outside contributions. Please see our\n[Contributing Guide](CONTRIBUTING.md) for details on how best to contribute.\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "The Cloud SQL Python Connector is a library that can be used alongside a database driver to allow users with sufficient permissions to connect to a Cloud SQL database without having to manually allowlist IPs or manage SSL certificates.",
    "version": "1.13.0",
    "project_urls": {
        "Homepage": "https://github.com/GoogleCloudPlatform/cloud-sql-python-connector"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e15983520849245a67dbf7d8e8039145143aa3ec276ef9ef51512d7587c1610d",
                "md5": "b884171e7dfd2b534da80f6b6575cfdb",
                "sha256": "238d963225761031648da8b208e2664a773fc27bc362538a381166297dbad687"
            },
            "downloads": -1,
            "filename": "cloud_sql_python_connector-1.13.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b884171e7dfd2b534da80f6b6575cfdb",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.9",
            "size": 42976,
            "upload_time": "2024-10-22T19:02:34",
            "upload_time_iso_8601": "2024-10-22T19:02:34.587337Z",
            "url": "https://files.pythonhosted.org/packages/e1/59/83520849245a67dbf7d8e8039145143aa3ec276ef9ef51512d7587c1610d/cloud_sql_python_connector-1.13.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9d556f0d510cc2ef5bd2b8ed1811e9f68108f4d3c1512b73029856a0678eccb4",
                "md5": "a4c5baaa926c4ea89c902439e4f205f7",
                "sha256": "f68d40e47a36a999ba8a4586da4b14995769de52884844d7cdd4de4b6d12e87e"
            },
            "downloads": -1,
            "filename": "cloud_sql_python_connector-1.13.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a4c5baaa926c4ea89c902439e4f205f7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 32208,
            "upload_time": "2024-10-22T19:02:36",
            "upload_time_iso_8601": "2024-10-22T19:02:36.591845Z",
            "url": "https://files.pythonhosted.org/packages/9d/55/6f0d510cc2ef5bd2b8ed1811e9f68108f4d3c1512b73029856a0678eccb4/cloud_sql_python_connector-1.13.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-22 19:02:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "GoogleCloudPlatform",
    "github_project": "cloud-sql-python-connector",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "aiofiles",
            "specs": [
                [
                    "==",
                    "24.1.0"
                ]
            ]
        },
        {
            "name": "aiohttp",
            "specs": [
                [
                    "==",
                    "3.10.10"
                ]
            ]
        },
        {
            "name": "cryptography",
            "specs": [
                [
                    "==",
                    "43.0.3"
                ]
            ]
        },
        {
            "name": "Requests",
            "specs": [
                [
                    "==",
                    "2.32.3"
                ]
            ]
        },
        {
            "name": "google-auth",
            "specs": [
                [
                    "==",
                    "2.35.0"
                ]
            ]
        }
    ],
    "lcname": "cloud-sql-python-connector"
}
        
Elapsed time: 0.40962s