-
Notifications
You must be signed in to change notification settings - Fork 83
Closed
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
Description
Currently we cache Instance()
configs by instance connection name. Which means we throw an error if users try to connect to the same instance with enable_iam_auth=False
and then with enable_iam_auth=True
or vice versa. Instead if we hash with the additional iam info we could support both without needing to throw an error.
Alternative: If IAM authn flag has been changed, we force a refresh to get a new cert to avoid duplicating admin API calls.
cloud-sql-python-connector/google/cloud/sql/connector/connector.py
Lines 222 to 231 in a8481e0
enable_iam_auth = kwargs.pop("enable_iam_auth", self._enable_iam_auth) | |
if instance_connection_string in self._instances: | |
instance = self._instances[instance_connection_string] | |
if enable_iam_auth != instance._enable_iam_auth: | |
raise ValueError( | |
f"connect() called with 'enable_iam_auth={enable_iam_auth}', " | |
f"but previously used 'enable_iam_auth={instance._enable_iam_auth}'. " | |
"If you require both for your use case, please use a new " | |
"connector.Connector object." | |
) |
Metadata
Metadata
Assignees
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.