Skip to content

chore(spanner): deprecate experimental host option/parameter to replace with Spanner Omni#17246

Open
sagnghos wants to merge 3 commits into
googleapis:mainfrom
sagnghos:sagnghos/spannerOmni
Open

chore(spanner): deprecate experimental host option/parameter to replace with Spanner Omni#17246
sagnghos wants to merge 3 commits into
googleapis:mainfrom
sagnghos:sagnghos/spannerOmni

Conversation

@sagnghos
Copy link
Copy Markdown
Contributor

@sagnghos sagnghos commented May 26, 2026

This PR deprecates the experimental_host parameter across public Client, AsyncClient, and DB-API connect interfaces, introducing the new unified instance_type parameter.

The instance_type option supports cloud and omni connection types; setting the type to cloud currently acts as a no-op, whereas establishing a connection to a Spanner Omni instance strictly requires setting instance_type="omni".

Internally, all private _experimental_host attributes have been purged and refactored to dynamically resolve endpoints via client properties, all public docs-strings have been updated to describe this behavior.

Refer to discussion: Spanner Client Library Configuration for Omni

Similar PR in java-spanner googleapis/google-cloud-java#13236

@sagnghos sagnghos requested a review from a team as a code owner May 26, 2026 05:44
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request deprecates the experimental_host parameter across the Spanner client library, replacing it with a new instance_type parameter (supporting "cloud", "omni", and "emulator") and transitioning Spanner Omni connections to use standard client_options with api_endpoint. Feedback on this PR highlights critical issues regarding dictionary handling for client_options in both sync and async client constructors, potential AttributeErrors in Database classes if self._instance is None, and the unintended discarding of custom client options in the DB-API connection module.

Comment thread packages/google-cloud-spanner/google/cloud/spanner_v1/_async/client.py Outdated
Comment thread packages/google-cloud-spanner/google/cloud/spanner_v1/client.py Outdated
Comment thread packages/google-cloud-spanner/google/cloud/spanner_dbapi/connection.py Outdated
Comment thread packages/google-cloud-spanner/google/cloud/spanner_v1/_async/database.py Outdated
Comment thread packages/google-cloud-spanner/google/cloud/spanner_v1/database.py Outdated
@parthea parthea added kokoro:force-run Add this label to force Kokoro to re-run the tests. kokoro:run Add this label to force Kokoro to re-run the tests. labels May 26, 2026
@yoshi-kokoro yoshi-kokoro removed kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels May 26, 2026
@sagnghos
Copy link
Copy Markdown
Contributor Author

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request deprecates the experimental_host parameter in favor of using client_options with api_endpoint and setting instance_type="omni" to connect to Spanner Omni instances. It introduces an InstanceType class containing constants for different instance types and updates transport creation helpers, client initialization, database session managers, and tests to support this new configuration. The review comments suggest two improvements: setting self._instance_type to InstanceType.EMULATOR when the emulator host is active in both sync and async clients, and using getattr defensively to retrieve _client from self._database._instance in both sync and async database session managers.

Comment thread packages/google-cloud-spanner/google/cloud/spanner_v1/client.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants