Skip to content

feat(dbapi): wire timeout parameter through Connection to execute_sql - #18484

Open
sakthivelmanii wants to merge 1 commit into
mainfrom
feat/dbapi-timeout
Open

sakthivelmanii wants to merge 1 commit into
mainfrom
feat/dbapi-timeout

Conversation

@sakthivelmanii

Copy link
Copy Markdown
Contributor
  • Wire timeout parameter to Connection.init, connect(), run_statement(), and validate().
  • Pass timeout from connection to execute_sql and batch_update calls when specified.
  • Add unit tests for DBAPI timeout propagation.

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕

@sakthivelmanii
sakthivelmanii requested a review from a team as a code owner September 28, 2026 10:57

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

Copy link
Copy Markdown
Contributor

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 introduces timeout support for Spanner DB-API operations, allowing users to specify a timeout duration for connections and individual SQL statements. It updates the Connection, Cursor, and batch_dml_executor modules to propagate this timeout value and includes comprehensive unit tests. The reviewer suggests refactoring the _do_batch_update_autocommit function to accept the timeout parameter directly instead of the cursor object to improve decoupling and simplify parameter handling.

Comment thread packages/google-cloud-spanner/google/cloud/spanner_dbapi/batch_dml_executor.py Outdated
Comment thread packages/google-cloud-spanner/google/cloud/spanner_dbapi/batch_dml_executor.py Outdated
- Wire timeout parameter to Connection.__init__, connect(), run_statement(), and validate().
- Pass timeout from connection to execute_sql and batch_update calls when specified.
- Add unit tests for DBAPI timeout propagation.

This branch has not been deployed

No deployments
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.

1 participant