-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(dbapi): wire timeout parameter through Connection to execute_sql #16497
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -228,12 +228,17 @@ def _do_execute_update_in_autocommit(self, transaction, sql, params): | |||||||||
| """This function should only be used in autocommit mode.""" | ||||||||||
| self.connection._transaction = transaction | ||||||||||
| self.connection._snapshot = None | ||||||||||
| self._result_set = transaction.execute_sql( | ||||||||||
| sql, | ||||||||||
| kwargs = dict( | ||||||||||
| params=params, | ||||||||||
| param_types=get_param_types(params), | ||||||||||
| last_statement=True, | ||||||||||
| ) | ||||||||||
| if self.connection._timeout is not None: | ||||||||||
| kwargs["timeout"] = self.connection._timeout | ||||||||||
|
Comment on lines
+236
to
+237
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is better to use the public
Suggested change
|
||||||||||
| self._result_set = transaction.execute_sql( | ||||||||||
| sql, | ||||||||||
| **kwargs, | ||||||||||
| ) | ||||||||||
| self._itr = PeekIterator(self._result_set) | ||||||||||
| self._row_count = None | ||||||||||
|
|
||||||||||
|
|
@@ -542,11 +547,16 @@ def _fetch(self, cursor_statement_type, size=None): | |||||||||
| return rows | ||||||||||
|
|
||||||||||
| def _handle_DQL_with_snapshot(self, snapshot, sql, params): | ||||||||||
| kwargs = dict( | ||||||||||
| param_types=get_param_types(params), | ||||||||||
| request_options=self.request_options, | ||||||||||
| ) | ||||||||||
| if self.connection._timeout is not None: | ||||||||||
| kwargs["timeout"] = self.connection._timeout | ||||||||||
|
Comment on lines
+554
to
+555
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is better to use the public
Suggested change
|
||||||||||
| self._result_set = snapshot.execute_sql( | ||||||||||
| sql, | ||||||||||
| params, | ||||||||||
| get_param_types(params), | ||||||||||
| request_options=self.request_options, | ||||||||||
| **kwargs, | ||||||||||
| ) | ||||||||||
| # Read the first element so that the StreamedResultSet can | ||||||||||
| # return the metadata after a DQL statement. | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using the public
timeoutproperty instead of the private_timeoutattribute for consistency, even within the class methods.