cloud-sql-python-connector 1.18.4__tar.gz → 1.19.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/PKG-INFO +19 -6
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/README.md +18 -5
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/cloud_sql_python_connector.egg-info/PKG-INFO +19 -6
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/google/cloud/sql/connector/connector.py +11 -0
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/google/cloud/sql/connector/refresh_utils.py +0 -1
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/google/cloud/sql/connector/version.py +1 -1
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/LICENSE +0 -0
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/cloud_sql_python_connector.egg-info/SOURCES.txt +0 -0
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/cloud_sql_python_connector.egg-info/dependency_links.txt +0 -0
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/cloud_sql_python_connector.egg-info/requires.txt +0 -0
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/cloud_sql_python_connector.egg-info/top_level.txt +0 -0
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/google/cloud/sql/connector/__init__.py +0 -0
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/google/cloud/sql/connector/asyncpg.py +0 -0
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/google/cloud/sql/connector/client.py +1 -1
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/google/cloud/sql/connector/connection_info.py +0 -0
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/google/cloud/sql/connector/connection_name.py +0 -0
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/google/cloud/sql/connector/enums.py +0 -0
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/google/cloud/sql/connector/exceptions.py +0 -0
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/google/cloud/sql/connector/instance.py +0 -0
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/google/cloud/sql/connector/lazy.py +0 -0
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/google/cloud/sql/connector/monitored_cache.py +0 -0
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/google/cloud/sql/connector/pg8000.py +0 -0
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/google/cloud/sql/connector/py.typed +0 -0
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/google/cloud/sql/connector/pymysql.py +0 -0
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/google/cloud/sql/connector/pytds.py +0 -0
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/google/cloud/sql/connector/rate_limiter.py +0 -0
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/google/cloud/sql/connector/resolver.py +0 -0
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/google/cloud/sql/connector/utils.py +0 -0
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/pyproject.toml +0 -0
- {cloud_sql_python_connector-1.18.4 → cloud_sql_python_connector-1.19.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cloud-sql-python-connector
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.19.0
|
|
4
4
|
Summary: Google Cloud SQL Python Connector library
|
|
5
5
|
Author-email: Google LLC <googleapis-packages@google.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -387,14 +387,27 @@ conn = connector.connect(
|
|
|
387
387
|
)
|
|
388
388
|
```
|
|
389
389
|
|
|
390
|
-
### Using DNS domain names to identify instances
|
|
390
|
+
### Using Advanced Disaster Recovery and DNS domain names to identify instances
|
|
391
391
|
|
|
392
|
-
The connector can be configured to use DNS to look up an instance.
|
|
393
|
-
|
|
394
|
-
|
|
392
|
+
The connector can be configured to use DNS to look up an instance.
|
|
393
|
+
Use a DNS name managed by Cloud SQL [Advanced Disaster Recovery](https://docs.cloud.google.com/sql/docs/mysql/use-advanced-disaster-recovery),
|
|
394
|
+
or a domain name that you manage.
|
|
395
|
+
|
|
396
|
+
#### Using Advanced Recovery Write Endpoint DNS Name
|
|
397
|
+
|
|
398
|
+
[Advanced Disaster Recovery](https://docs.cloud.google.com/sql/docs/mysql/use-advanced-disaster-recovery)
|
|
399
|
+
creates geographically distributed replicas of your Cloud SQL database instance. When you perform
|
|
400
|
+
switchover or failover on the database instance, the connector will gracefully disconnect from the
|
|
401
|
+
old primary instance and reconnect to the new primary instance.
|
|
402
|
+
|
|
403
|
+
Follow the instructions in [Connect using Write Endpoint](https://docs.cloud.google.com/sql/docs/mysql/connect-to-instance-using-write-endpoint)
|
|
404
|
+
to get the write endpoint DNS name for your primary instance. Then, use this write endpoint DNS
|
|
405
|
+
name to configure the connector.
|
|
395
406
|
|
|
396
407
|
#### Configure your DNS Records
|
|
397
408
|
|
|
409
|
+
The connector may be configured to use DNS that you define as well.
|
|
410
|
+
|
|
398
411
|
Add a DNS TXT record for the Cloud SQL instance to a **private** DNS server
|
|
399
412
|
or a private Google Cloud DNS Zone used by your application.
|
|
400
413
|
|
|
@@ -605,7 +618,7 @@ from google.cloud.sql.connector import Connector, create_async_connector
|
|
|
605
618
|
|
|
606
619
|
async def main():
|
|
607
620
|
# initialize Connector object for connections to Cloud SQL
|
|
608
|
-
connector = create_async_connector()
|
|
621
|
+
connector = await create_async_connector()
|
|
609
622
|
|
|
610
623
|
# creation function to generate asyncpg connections as the 'connect' arg
|
|
611
624
|
async def getconn(instance_connection_name, **kwargs) -> asyncpg.Connection:
|
|
@@ -348,14 +348,27 @@ conn = connector.connect(
|
|
|
348
348
|
)
|
|
349
349
|
```
|
|
350
350
|
|
|
351
|
-
### Using DNS domain names to identify instances
|
|
351
|
+
### Using Advanced Disaster Recovery and DNS domain names to identify instances
|
|
352
352
|
|
|
353
|
-
The connector can be configured to use DNS to look up an instance.
|
|
354
|
-
|
|
355
|
-
|
|
353
|
+
The connector can be configured to use DNS to look up an instance.
|
|
354
|
+
Use a DNS name managed by Cloud SQL [Advanced Disaster Recovery](https://docs.cloud.google.com/sql/docs/mysql/use-advanced-disaster-recovery),
|
|
355
|
+
or a domain name that you manage.
|
|
356
|
+
|
|
357
|
+
#### Using Advanced Recovery Write Endpoint DNS Name
|
|
358
|
+
|
|
359
|
+
[Advanced Disaster Recovery](https://docs.cloud.google.com/sql/docs/mysql/use-advanced-disaster-recovery)
|
|
360
|
+
creates geographically distributed replicas of your Cloud SQL database instance. When you perform
|
|
361
|
+
switchover or failover on the database instance, the connector will gracefully disconnect from the
|
|
362
|
+
old primary instance and reconnect to the new primary instance.
|
|
363
|
+
|
|
364
|
+
Follow the instructions in [Connect using Write Endpoint](https://docs.cloud.google.com/sql/docs/mysql/connect-to-instance-using-write-endpoint)
|
|
365
|
+
to get the write endpoint DNS name for your primary instance. Then, use this write endpoint DNS
|
|
366
|
+
name to configure the connector.
|
|
356
367
|
|
|
357
368
|
#### Configure your DNS Records
|
|
358
369
|
|
|
370
|
+
The connector may be configured to use DNS that you define as well.
|
|
371
|
+
|
|
359
372
|
Add a DNS TXT record for the Cloud SQL instance to a **private** DNS server
|
|
360
373
|
or a private Google Cloud DNS Zone used by your application.
|
|
361
374
|
|
|
@@ -566,7 +579,7 @@ from google.cloud.sql.connector import Connector, create_async_connector
|
|
|
566
579
|
|
|
567
580
|
async def main():
|
|
568
581
|
# initialize Connector object for connections to Cloud SQL
|
|
569
|
-
connector = create_async_connector()
|
|
582
|
+
connector = await create_async_connector()
|
|
570
583
|
|
|
571
584
|
# creation function to generate asyncpg connections as the 'connect' arg
|
|
572
585
|
async def getconn(instance_connection_name, **kwargs) -> asyncpg.Connection:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cloud-sql-python-connector
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.19.0
|
|
4
4
|
Summary: Google Cloud SQL Python Connector library
|
|
5
5
|
Author-email: Google LLC <googleapis-packages@google.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -387,14 +387,27 @@ conn = connector.connect(
|
|
|
387
387
|
)
|
|
388
388
|
```
|
|
389
389
|
|
|
390
|
-
### Using DNS domain names to identify instances
|
|
390
|
+
### Using Advanced Disaster Recovery and DNS domain names to identify instances
|
|
391
391
|
|
|
392
|
-
The connector can be configured to use DNS to look up an instance.
|
|
393
|
-
|
|
394
|
-
|
|
392
|
+
The connector can be configured to use DNS to look up an instance.
|
|
393
|
+
Use a DNS name managed by Cloud SQL [Advanced Disaster Recovery](https://docs.cloud.google.com/sql/docs/mysql/use-advanced-disaster-recovery),
|
|
394
|
+
or a domain name that you manage.
|
|
395
|
+
|
|
396
|
+
#### Using Advanced Recovery Write Endpoint DNS Name
|
|
397
|
+
|
|
398
|
+
[Advanced Disaster Recovery](https://docs.cloud.google.com/sql/docs/mysql/use-advanced-disaster-recovery)
|
|
399
|
+
creates geographically distributed replicas of your Cloud SQL database instance. When you perform
|
|
400
|
+
switchover or failover on the database instance, the connector will gracefully disconnect from the
|
|
401
|
+
old primary instance and reconnect to the new primary instance.
|
|
402
|
+
|
|
403
|
+
Follow the instructions in [Connect using Write Endpoint](https://docs.cloud.google.com/sql/docs/mysql/connect-to-instance-using-write-endpoint)
|
|
404
|
+
to get the write endpoint DNS name for your primary instance. Then, use this write endpoint DNS
|
|
405
|
+
name to configure the connector.
|
|
395
406
|
|
|
396
407
|
#### Configure your DNS Records
|
|
397
408
|
|
|
409
|
+
The connector may be configured to use DNS that you define as well.
|
|
410
|
+
|
|
398
411
|
Add a DNS TXT record for the Cloud SQL instance to a **private** DNS server
|
|
399
412
|
or a private Google Cloud DNS Zone used by your application.
|
|
400
413
|
|
|
@@ -605,7 +618,7 @@ from google.cloud.sql.connector import Connector, create_async_connector
|
|
|
605
618
|
|
|
606
619
|
async def main():
|
|
607
620
|
# initialize Connector object for connections to Cloud SQL
|
|
608
|
-
connector = create_async_connector()
|
|
621
|
+
connector = await create_async_connector()
|
|
609
622
|
|
|
610
623
|
# creation function to generate asyncpg connections as the 'connect' arg
|
|
611
624
|
async def getconn(instance_connection_name, **kwargs) -> asyncpg.Connection:
|
|
@@ -28,11 +28,13 @@ from typing import Any, Callable, Optional, Union
|
|
|
28
28
|
import google.auth
|
|
29
29
|
from google.auth.credentials import Credentials
|
|
30
30
|
from google.auth.credentials import with_scopes_if_required
|
|
31
|
+
|
|
31
32
|
import google.cloud.sql.connector.asyncpg as asyncpg
|
|
32
33
|
from google.cloud.sql.connector.client import CloudSQLClient
|
|
33
34
|
from google.cloud.sql.connector.enums import DriverMapping
|
|
34
35
|
from google.cloud.sql.connector.enums import IPTypes
|
|
35
36
|
from google.cloud.sql.connector.enums import RefreshStrategy
|
|
37
|
+
from google.cloud.sql.connector.exceptions import ConnectorLoopError
|
|
36
38
|
from google.cloud.sql.connector.instance import RefreshAheadCache
|
|
37
39
|
from google.cloud.sql.connector.lazy import LazyRefreshCache
|
|
38
40
|
from google.cloud.sql.connector.monitored_cache import MonitoredCache
|
|
@@ -280,6 +282,15 @@ class Connector:
|
|
|
280
282
|
KeyError: Unsupported database driver Must be one of pymysql, asyncpg,
|
|
281
283
|
pg8000, and pytds.
|
|
282
284
|
"""
|
|
285
|
+
# check if event loop is running in current thread
|
|
286
|
+
if self._loop != asyncio.get_running_loop():
|
|
287
|
+
raise ConnectorLoopError(
|
|
288
|
+
"Running event loop does not match 'connector._loop'. "
|
|
289
|
+
"Connector.connect_async() must be called from the event loop "
|
|
290
|
+
"the Connector was initialized with. If you need to connect "
|
|
291
|
+
"across event loops, please use a new Connector object."
|
|
292
|
+
)
|
|
293
|
+
|
|
283
294
|
if self._keys is None:
|
|
284
295
|
self._keys = asyncio.create_task(generate_keys())
|
|
285
296
|
if self._client is None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -22,9 +22,9 @@ from typing import Any, Optional, TYPE_CHECKING
|
|
|
22
22
|
import aiohttp
|
|
23
23
|
from cryptography.hazmat.backends import default_backend
|
|
24
24
|
from cryptography.x509 import load_pem_x509_certificate
|
|
25
|
-
|
|
26
25
|
from google.auth.credentials import TokenState
|
|
27
26
|
from google.auth.transport import requests
|
|
27
|
+
|
|
28
28
|
from google.cloud.sql.connector.connection_info import ConnectionInfo
|
|
29
29
|
from google.cloud.sql.connector.connection_name import ConnectionName
|
|
30
30
|
from google.cloud.sql.connector.exceptions import AutoIAMAuthNotSupported
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|