Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.

feat: automatic dialect detection#1676

Closed
olavloite wants to merge 15 commits intomainfrom
automatic-dialect-detection
Closed

feat: automatic dialect detection#1676
olavloite wants to merge 15 commits intomainfrom
automatic-dialect-detection

Conversation

@olavloite
Copy link
Copy Markdown
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, ansh0l and thiagotnunes February 10, 2022 17:24
Base automatically changed from postgresql to main February 10, 2022 17:47
@olavloite
Copy link
Copy Markdown
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 subscribe to this conversation on GitHub. Already have an account? Sign in.

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