Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/GoogleCloudPlatform/cloud-sql-python-connector
/ functions
Functions
277 in github.com/GoogleCloudPlatform/cloud-sql-python-connector
⨍
Functions
277
◇
Types & classes
29
↳
Endpoints
6
↓ 44 callers
Method
connect
(sock: ssl.SSLSocket)
tests/unit/test_pymysql.py:31
↓ 33 callers
Method
close
Close Connector by stopping tasks and releasing resources.
google/cloud/sql/connector/connector.py:502
↓ 16 callers
Function
generate_keys
A helper function to generate the private and public keys. backend - The value specified is default_backend(). This is because the cryptograp
google/cloud/sql/connector/utils.py:23
↓ 14 callers
Method
connect_async
Connect asynchronously to a Cloud SQL instance. Prepares and returns a database connection object connected to a Cloud SQL instance u
google/cloud/sql/connector/connector.py:261
↓ 12 callers
Method
close_async
Helper function to cancel the cache's tasks and close aiohttp.ClientSession.
google/cloud/sql/connector/connector.py:518
↓ 11 callers
Function
_is_valid
(task: asyncio.Task)
google/cloud/sql/connector/refresh_utils.py:69
↓ 10 callers
Method
connect
Connect to a Cloud SQL instance. Prepares and returns a database connection object connected to a Cloud SQL instance using SSL/TLS. S
google/cloud/sql/connector/connector.py:220
↓ 8 callers
Method
_schedule_refresh
Schedule task to sleep and then perform refresh to get ConnectionInfo. Args: delay (int): Time in seconds to sleep befor
google/cloud/sql/connector/instance.py:141
↓ 8 callers
Method
resolve
(self, dns: str)
google/cloud/sql/connector/resolver.py:41
↓ 7 callers
Method
close
Close CloudSQLClient gracefully.
google/cloud/sql/connector/client.py:324
↓ 6 callers
Method
_get_metadata
Requests metadata from the Cloud SQL Instance and returns a dictionary containing the IP addresses and certificate authority of the Cloud SQL
google/cloud/sql/connector/client.py:96
↓ 6 callers
Function
create_sqlalchemy_engine
Creates a connection pool for a Cloud SQL instance and returns the pool and the connector. Callers are responsible for closing the pool and the
tests/system/test_pg8000_connection.py:30
↓ 5 callers
Method
acquire
Waits for a token to become available, if necessary, then subtracts token and allows request to go through.
google/cloud/sql/connector/rate_limiter.py:69
↓ 5 callers
Method
close
(self)
google/cloud/sql/connector/monitored_cache.py:111
↓ 5 callers
Method
connect_info
Retrieves ConnectionInfo instance for establishing a secure connection to the Cloud SQL instance.
google/cloud/sql/connector/lazy.py:84
↓ 5 callers
Method
get_preferred_ip
Returns the first IP address for the instance, according to the preference supplied by ip_type. If no IP addressess with the given preference
google/cloud/sql/connector/connection_info.py:121
↓ 5 callers
Function
retry_50x
Retry any 50x HTTP response up to X number of times.
google/cloud/sql/connector/refresh_utils.py:141
↓ 4 callers
Method
_get_ephemeral
Asynchronously requests an ephemeral certificate from the Cloud SQL Instance. Args: project (str): A string representing the nam
google/cloud/sql/connector/client.py:180
↓ 4 callers
Function
_parse_connection_name
(connection_name: str)
google/cloud/sql/connector/connection_name.py:56
↓ 4 callers
Function
_seconds_until_refresh
Calculates the duration to wait before starting the next refresh. Usually the duration will be half of the time until certificate expira
google/cloud/sql/connector/refresh_utils.py:38
↓ 4 callers
Function
create_sqlalchemy_engine
Creates a connection pool for a Cloud SQL instance and returns the pool and the connector. Callers are responsible for closing the pool and the
tests/system/test_asyncpg_connection.py:30
↓ 4 callers
Function
default
(session, path)
noxfile.py:99
↓ 4 callers
Method
get_connection_string
Get the instance connection string for the Cloud SQL instance.
google/cloud/sql/connector/connection_name.py:45
↓ 4 callers
Function
init_connection_engine
( custom_connector: Connector, )
tests/system/test_connector_object.py:31
↓ 3 callers
Method
_from_str
Convert IP type from a str into IPTypes.
google/cloud/sql/connector/enums.py:53
↓ 3 callers
Function
_parse_connection_name_with_domain_name
( connection_name: str, domain_name: str )
google/cloud/sql/connector/connection_name.py:60
↓ 3 callers
Method
_perform_refresh
Retrieves instance metadata and ephemeral certificate from the Cloud SQL Instance. Returns: A ConnectionInfo instance con
google/cloud/sql/connector/instance.py:100
↓ 3 callers
Method
_purge_closed_sockets
Remove closed sockets from monitored cache. If a socket is closed by the database driver we should remove it from list of sockets.
google/cloud/sql/connector/monitored_cache.py:58
↓ 3 callers
Function
connect
Helper function to create a pytds DB-API connection object. Args: ip_address (str): A string containing an IP address for the Cloud SQL
google/cloud/sql/connector/pytds.py:27
↓ 3 callers
Function
create_sqlalchemy_engine
Creates a connection pool for a Cloud SQL instance and returns the pool and the connector. Callers are responsible for closing the pool and the
tests/system/test_pymysql_iam_auth.py:25
↓ 3 callers
Function
create_sqlalchemy_engine
Creates a connection pool for a Cloud SQL instance and returns the pool and the connector. Callers are responsible for closing the pool and the
tests/system/test_pymysql_connection.py:26
↓ 3 callers
Method
create_ssl_context
Constructs a SSL/TLS context for the given connection info. Cache the SSL context to ensure we don't read from disk repeatedly when c
google/cloud/sql/connector/connection_info.py:73
↓ 3 callers
Method
resolve_a_record
(self, dns: str)
google/cloud/sql/connector/resolver.py:58
↓ 3 callers
Function
write_to_file
Helper function to write the serverCaCert, ephemeral certificate and private key to .pem files in a given directory
google/cloud/sql/connector/utils.py:60
↓ 2 callers
Function
_downscope_credentials
Generate a down-scoped credential. Args: credentials (google.auth.credentials.Credentials): Credentials object used to genera
google/cloud/sql/connector/refresh_utils.py:81
↓ 2 callers
Function
_exponential_backoff
Calculates a duration to backoff in milliseconds based on the attempt i. The formula is: base * multi^(attempt + 1 + random) With base
google/cloud/sql/connector/refresh_utils.py:113
↓ 2 callers
Function
_is_valid_domain
(domain_name: str)
google/cloud/sql/connector/connection_name.py:50
↓ 2 callers
Method
_update_token_count
Calculates how much time has passed since the last leak and removes the appropriate amount of events from the queue. Leaking
google/cloud/sql/connector/rate_limiter.py:47
↓ 2 callers
Function
client_key_signed_cert
Create a PEM encoded certificate that is signed by given public key.
tests/unit/mocks.py:159
↓ 2 callers
Method
close
Close is a no-op and provided purely for a consistent interface with other cache types.
google/cloud/sql/connector/lazy.py:130
↓ 2 callers
Method
connect_info
(self)
google/cloud/sql/connector/monitored_cache.py:98
↓ 2 callers
Function
create_asyncpg_pool
Creates a native asyncpg connection pool for a Cloud SQL instance and returns the pool and the connector. Callers are responsible for closing the
tests/system/test_asyncpg_connection.py:103
↓ 2 callers
Function
create_sqlalchemy_engine
Creates a connection pool for a Cloud SQL instance and returns the pool and the connector. Callers are responsible for closing the pool and the
tests/system/test_pytds_connection.py:25
↓ 2 callers
Function
create_sqlalchemy_engine
Creates a connection pool for a Cloud SQL instance and returns the pool and the connector. Callers are responsible for closing the pool and the
tests/system/test_pg8000_iam_auth.py:25
↓ 2 callers
Function
create_sqlalchemy_engine
Creates a connection pool for a Cloud SQL instance and returns the pool and the connector. Callers are responsible for closing the pool and the
tests/system/test_asyncpg_iam_auth.py:26
↓ 2 callers
Method
force_refresh
Invalidates the cache and configures the next call to connect_info() to retrieve a fresh ConnectionInfo instance.
google/cloud/sql/connector/lazy.py:76
↓ 2 callers
Method
get_connection_info
Immediately performs a full refresh operation using the Cloud SQL Admin API. Args: conn_name (ConnectionName): The Cloud
google/cloud/sql/connector/client.py:251
↓ 2 callers
Function
increment
()
tests/unit/test_rate_limiter.py:32
↓ 2 callers
Function
init_connection_engine
( connector: Connector, ip_type: IPTypes )
tests/system/test_ip_types.py:30
↓ 2 callers
Method
refresh
Refreshes the access token.
tests/unit/mocks.py:56
↓ 2 callers
Function
set_expiration
(expiration: datetime.datetime)
tests/unit/test_refresh_utils.py:51
↓ 1 callers
Method
_check_domain_name
(self)
google/cloud/sql/connector/monitored_cache.py:72
↓ 1 callers
Function
_format_user_agent
(driver: Optional[str], custom: Optional[str])
google/cloud/sql/connector/client.py:45
↓ 1 callers
Method
_remove_cached
Stops all background refreshes and deletes the connection info cache from the map of caches.
google/cloud/sql/connector/connector.py:463
↓ 1 callers
Method
_wait_for_next_token
Wait until enough time has elapsed to add another token.
google/cloud/sql/connector/rate_limiter.py:60
↓ 1 callers
Method
close
Cleanup function to make sure tasks have finished to have a graceful exit.
google/cloud/sql/connector/instance.py:212
↓ 1 callers
Function
connect
Helper function to create a pg8000 DB-API connection object. Args: ip_address (str): A string containing an IP address for the Cloud SQL
google/cloud/sql/connector/pg8000.py:24
↓ 1 callers
Function
connect
Helper function to create an asyncpg DB-API connection object. Args: ip_address (str): A string containing an IP address for the Cloud SQ
google/cloud/sql/connector/asyncpg.py:26
↓ 1 callers
Function
connect_to_db
Initializes the connector and engine if necessary, then returns a connection.
samples/cloudrun/sqlserver/main.py:63
↓ 1 callers
Function
connect_with_iam
Initializes the connector and IAM engine if necessary, then returns a connection.
samples/cloudrun/postgres/main.py:107
↓ 1 callers
Function
connect_with_iam
Initializes the connector and IAM engine if necessary, then returns a connection.
samples/cloudrun/mysql/main.py:106
↓ 1 callers
Function
connect_with_password
Initializes the connector and password engine if necessary, then returns a connection.
samples/cloudrun/postgres/main.py:91
↓ 1 callers
Function
connect_with_password
Initializes the connector and password engine if necessary, then returns a connection.
samples/cloudrun/mysql/main.py:90
↓ 1 callers
Function
create_async_connector
Helper function to create Connector object for asyncio connections. Force use of Connector in an asyncio context. Auto-detect and use current
google/cloud/sql/connector/connector.py:527
↓ 1 callers
Function
create_ssl_context
Helper method to build an ssl.SSLContext for tests
tests/unit/mocks.py:195
↓ 1 callers
Method
force_refresh
(self)
google/cloud/sql/connector/monitored_cache.py:105
↓ 1 callers
Function
format_database_user
Format database `user` param for Cloud SQL automatic IAM authentication. Args: database_version (str): Cloud SQL database version.
google/cloud/sql/connector/utils.py:81
↓ 1 callers
Function
generate_cert
Generate a private key and cert object to be used in testing.
tests/unit/mocks.py:112
↓ 1 callers
Method
query_dns
(self, dns: str)
google/cloud/sql/connector/resolver.py:68
↓ 1 callers
Method
resolve
(self, connection_name: str)
google/cloud/sql/connector/resolver.py:31
↓ 1 callers
Function
start_proxy_server
Run local proxy server capable of performing mTLS
tests/conftest.py:87
↓ 1 callers
Function
ticker
Ticker function to sleep for specified interval and then schedule call to given function.
google/cloud/sql/connector/monitored_cache.py:138
↓ 1 callers
Method
validate_engine
Validate that the given driver is compatible with the given engine. Args: driver (str): Database driver being used. (i.e. "pg8000
google/cloud/sql/connector/enums.py:69
Method
__aenter__
Enter async context manager by returning Connector object
google/cloud/sql/connector/connector.py:489
Method
__aexit__
Exit async context manager by closing Connector
google/cloud/sql/connector/connector.py:493
Method
__class__
(self)
tests/unit/mocks.py:52
Method
__enter__
Enter context manager by returning Connector object
google/cloud/sql/connector/connector.py:476
Method
__exit__
Exit context manager by closing Connector
google/cloud/sql/connector/connector.py:480
Method
__init__
Establishes the client to be used for Cloud SQL Admin API requests. Args: sqladmin_api_endpoint (str): Base URL to use when calli
google/cloud/sql/connector/client.py:53
Method
__init__
Initializes a LazyRefreshCache instance. Args: conn_name (ConnectionName): The Cloud SQL instance's connection na
google/cloud/sql/connector/lazy.py:40
Method
__init__
Initializes a Connector instance. Args: ip_type (str | IPTypes): The default IP address type used to connect to C
google/cloud/sql/connector/connector.py:62
Method
__init__
Initializes a RefreshAheadCache instance. Args: conn_name (ConnectionName): The Cloud SQL instance's connection n
google/cloud/sql/connector/instance.py:47
Method
__init__
( self, max_capacity: int = 1, rate: float = 1 / 60, loop: Optional[asyncio.Ab
google/cloud/sql/connector/rate_limiter.py:34
Method
__init__
( self, cache: Union[RefreshAheadCache, LazyRefreshCache], failover_period: int,
google/cloud/sql/connector/monitored_cache.py:32
Method
__init__
(self, host: str, defer_connect: bool, **kwargs: Any)
tests/unit/test_pymysql.py:28
Method
__init__
(self, expiration: datetime.datetime)
tests/unit/test_refresh_utils.py:47
Method
__init__
(self)
tests/unit/test_refresh_utils.py:177
Method
__init__
( self, token: Optional[str] = None, expiry: Optional[datetime.datetime] = None )
tests/unit/mocks.py:44
Method
__init__
( self, project: str = "test-project", region: str = "test-region", name: str
tests/unit/mocks.py:220
Method
__str__
(self)
google/cloud/sql/connector/connection_name.py:40
Method
_from_str
Convert refresh strategy from a str into RefreshStrategy.
google/cloud/sql/connector/enums.py:35
Method
_missing_
(cls, value: object)
google/cloud/sql/connector/enums.py:28
Method
_missing_
(cls, value: object)
google/cloud/sql/connector/enums.py:46
Method
_refresh_task
A coroutine that sleeps for the specified amount of time before running _perform_refresh.
google/cloud/sql/connector/instance.py:152
Function
build
Just run the default tools to install requirements.
noxfile.py:90
Function
cache
(fake_client: CloudSQLClient)
tests/conftest.py:185
Method
close
(self)
google/cloud/sql/connector/connection_info.py:50
Method
closed
(self)
google/cloud/sql/connector/connection_info.py:55
Method
closed
(self)
google/cloud/sql/connector/lazy.py:73
Method
closed
(self)
google/cloud/sql/connector/instance.py:85
next →
1–100 of 277, ranked by callers