-
Notifications
You must be signed in to change notification settings - Fork 88
Validate driver matches database type #998
Copy link
Copy link
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.
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.
The behavior where someone passes a valid instance connection name for a Cloud SQL instance but for the wrong driver is slightly ambiguous currently. (ex. instance connection name for a Cloud SQL Postgres instance but with
pymysqldriver)We should make an enum mapping drivers to database type and verify that the driver being used is correct before attempting a connection. This way we can throw a helpful error message to users pointing at the wrong instance.
We are already returning the database version as part of the metadata request so this should be pretty straightforward.
cloud-sql-python-connector/google/cloud/sql/connector/refresh_utils.py
Lines 110 to 114 in 25a740a