summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-04-21 16:08:19 +0000
committerCoprDistGit <infra@openeuler.org>2023-04-21 16:08:19 +0000
commitd66282fde462e0c413ab5c18f2e607e483c09dc6 (patch)
treef6845ada821a601a3c9420e00aab775aa04da96c
parent6261f723c8f3586e634ea1e38eb8ff09e0868bdf (diff)
automatic import of python-cloud-sql-python-connectoropeneuler20.03
-rw-r--r--.gitignore1
-rw-r--r--python-cloud-sql-python-connector.spec68
-rw-r--r--sources2
3 files changed, 66 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 4df3d8d..8136a2c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
/cloud-sql-python-connector-1.2.1.tar.gz
+/cloud-sql-python-connector-1.2.2.tar.gz
diff --git a/python-cloud-sql-python-connector.spec b/python-cloud-sql-python-connector.spec
index a5e870b..7247857 100644
--- a/python-cloud-sql-python-connector.spec
+++ b/python-cloud-sql-python-connector.spec
@@ -1,11 +1,11 @@
%global _empty_manifest_terminate_build 0
Name: python-cloud-sql-python-connector
-Version: 1.2.1
+Version: 1.2.2
Release: 1
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.
License: Apache 2.0
URL: https://github.com/GoogleCloudPlatform/cloud-sql-python-connector
-Source0: https://mirrors.nju.edu.cn/pypi/web/packages/91/39/91193e576e1580179e14c91e92b1b502f25d58bf22f70232cc8577f1d9f0/cloud-sql-python-connector-1.2.1.tar.gz
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/32/04/fbf7f82a7a17c932ba9cd35cb37d8b3c7de84147a0e34ae164fd541fa497/cloud-sql-python-connector-1.2.2.tar.gz
BuildArch: noarch
Requires: python3-aiohttp
@@ -134,6 +134,7 @@ The `Connector` itself creates connection objects by calling its `connect` metho
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
@@ -160,6 +161,7 @@ pool = sqlalchemy.create_engine(
```
The returned connection pool engine can then be used to query and modify the database.
+
```python
# insert statement
insert_stmt = sqlalchemy.text(
@@ -173,6 +175,9 @@ with pool.connect() as db_conn:
# 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)
@@ -246,6 +251,9 @@ 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()
@@ -255,8 +263,10 @@ with pool.connect() as db_conn:
```
### Specifying Public or Private IP
+
The Cloud SQL Connector for Python can be used to connect to Cloud SQL instances using both public and private IP addresses. To specify which IP address to use to connect, set the `ip_type` keyword argument Possible values are `IPTypes.PUBLIC` and `IPTypes.PRIVATE`.
Example:
+
```python
from google.cloud.sql.connector import IPTypes
@@ -271,6 +281,7 @@ connector.connect(
Note: If specifying Private IP, your application must already be in the same VPC network as your Cloud SQL Instance.
### IAM 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).
@@ -282,6 +293,7 @@ In the call to connect, set the `enable_iam_auth` keyword argument to true and t
> 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
connector.connect(
"project:region:instance",
@@ -293,9 +305,11 @@ connector.connect(
```
### SQL Server 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
connector.connect(
"project:region:instance",
@@ -305,7 +319,9 @@ connector.connect(
server_name="public.[instance].[location].[project].cloudsql.[domain]",
)
```
+
Or, if using Private IP:
+
```python
connector.connect(
"project:region:instance",
@@ -318,11 +334,13 @@ connector.connect(
```
### 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.
#### 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
@@ -368,6 +386,7 @@ For more details on how to use Flask-SQLAlchemy, check out the
[Flask-SQLAlchemy Quickstarts](https://flask-sqlalchemy.palletsprojects.com/en/2.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.
@@ -410,6 +429,7 @@ 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
@@ -677,6 +697,7 @@ The `Connector` itself creates connection objects by calling its `connect` metho
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
@@ -703,6 +724,7 @@ pool = sqlalchemy.create_engine(
```
The returned connection pool engine can then be used to query and modify the database.
+
```python
# insert statement
insert_stmt = sqlalchemy.text(
@@ -716,6 +738,9 @@ with pool.connect() as db_conn:
# 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)
@@ -789,6 +814,9 @@ 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()
@@ -798,8 +826,10 @@ with pool.connect() as db_conn:
```
### Specifying Public or Private IP
+
The Cloud SQL Connector for Python can be used to connect to Cloud SQL instances using both public and private IP addresses. To specify which IP address to use to connect, set the `ip_type` keyword argument Possible values are `IPTypes.PUBLIC` and `IPTypes.PRIVATE`.
Example:
+
```python
from google.cloud.sql.connector import IPTypes
@@ -814,6 +844,7 @@ connector.connect(
Note: If specifying Private IP, your application must already be in the same VPC network as your Cloud SQL Instance.
### IAM 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).
@@ -825,6 +856,7 @@ In the call to connect, set the `enable_iam_auth` keyword argument to true and t
> 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
connector.connect(
"project:region:instance",
@@ -836,9 +868,11 @@ connector.connect(
```
### SQL Server 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
connector.connect(
"project:region:instance",
@@ -848,7 +882,9 @@ connector.connect(
server_name="public.[instance].[location].[project].cloudsql.[domain]",
)
```
+
Or, if using Private IP:
+
```python
connector.connect(
"project:region:instance",
@@ -861,11 +897,13 @@ connector.connect(
```
### 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.
#### 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
@@ -911,6 +949,7 @@ For more details on how to use Flask-SQLAlchemy, check out the
[Flask-SQLAlchemy Quickstarts](https://flask-sqlalchemy.palletsprojects.com/en/2.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.
@@ -953,6 +992,7 @@ 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
@@ -1217,6 +1257,7 @@ The `Connector` itself creates connection objects by calling its `connect` metho
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
@@ -1243,6 +1284,7 @@ pool = sqlalchemy.create_engine(
```
The returned connection pool engine can then be used to query and modify the database.
+
```python
# insert statement
insert_stmt = sqlalchemy.text(
@@ -1256,6 +1298,9 @@ with pool.connect() as db_conn:
# 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)
@@ -1329,6 +1374,9 @@ 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()
@@ -1338,8 +1386,10 @@ with pool.connect() as db_conn:
```
### Specifying Public or Private IP
+
The Cloud SQL Connector for Python can be used to connect to Cloud SQL instances using both public and private IP addresses. To specify which IP address to use to connect, set the `ip_type` keyword argument Possible values are `IPTypes.PUBLIC` and `IPTypes.PRIVATE`.
Example:
+
```python
from google.cloud.sql.connector import IPTypes
@@ -1354,6 +1404,7 @@ connector.connect(
Note: If specifying Private IP, your application must already be in the same VPC network as your Cloud SQL Instance.
### IAM 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).
@@ -1365,6 +1416,7 @@ In the call to connect, set the `enable_iam_auth` keyword argument to true and t
> 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
connector.connect(
"project:region:instance",
@@ -1376,9 +1428,11 @@ connector.connect(
```
### SQL Server 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
connector.connect(
"project:region:instance",
@@ -1388,7 +1442,9 @@ connector.connect(
server_name="public.[instance].[location].[project].cloudsql.[domain]",
)
```
+
Or, if using Private IP:
+
```python
connector.connect(
"project:region:instance",
@@ -1401,11 +1457,13 @@ connector.connect(
```
### 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.
#### 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
@@ -1451,6 +1509,7 @@ For more details on how to use Flask-SQLAlchemy, check out the
[Flask-SQLAlchemy Quickstarts](https://flask-sqlalchemy.palletsprojects.com/en/2.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.
@@ -1493,6 +1552,7 @@ 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
@@ -1638,7 +1698,7 @@ We welcome outside contributions. Please see our
%prep
-%autosetup -n cloud-sql-python-connector-1.2.1
+%autosetup -n cloud-sql-python-connector-1.2.2
%build
%py3_build
@@ -1678,5 +1738,5 @@ mv %{buildroot}/doclist.lst .
%{_docdir}/*
%changelog
-* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 1.2.1-1
+* Fri Apr 21 2023 Python_Bot <Python_Bot@openeuler.org> - 1.2.2-1
- Package Spec generated
diff --git a/sources b/sources
index 20cb9f4..d4ca2fe 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-2372e98c968b815cb9b22cd8955bdf9e cloud-sql-python-connector-1.2.1.tar.gz
+b1571fe3acd80189e069303afce0ff2c cloud-sql-python-connector-1.2.2.tar.gz