Skip to content

feat: automatic dialect detection #1676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
Closed

Conversation

olavloite
Copy link
Collaborator

The dialect of the database that a DatabaseClient is connected to can be automatically detected:

  1. DatabaseClient#getDialect() has been added. This method always returns the dialect of the underlying database. It will do so by executing a query that detects the dialect. This query can also be executed and cached automatically in the background during startup (see below).
  2. SessionPoolOptions#setAutoDetectDialect(true) will cause the dialect detection query to be executed in the background automatically when a new client is created. This is disabled by default, except for when a Connection API connection (or anything that depends on that, such as JDBC) is opened. The reason for this default behavior is that a normal Spanner instance does normally not need to know what the dialect of the underlying database is, while the Connection API does. This reduces the number of times the detection query will be executed during production use.

@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/java-spanner API. label Feb 9, 2022
@olavloite olavloite marked this pull request as ready for review February 10, 2022 17:24
@olavloite olavloite requested review from a team as code owners February 10, 2022 17:24
Base automatically changed from postgresql to main February 10, 2022 17:47
@olavloite
Copy link
Collaborator Author

Closing in favor of #1677

@olavloite olavloite closed this Feb 10, 2022
@olavloite olavloite deleted the automatic-dialect-detection branch February 10, 2022 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/java-spanner API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant