Provide rowcount for DML queries#325
Merged
hashhar merged 3 commits intotrinodb:masterfrom Jan 20, 2023
Merged
Conversation
hovaesco
approved these changes
Jan 18, 2023
| the number of rows is only knowns when all rows have been retrieved. | ||
| """ | ||
|
|
||
| if self._query is not None and self._query.update_count is not None: |
Member
There was a problem hiding this comment.
The comment above can be updated to reflect the change.
hashhar
reviewed
Jan 19, 2023
| self.update_type = update_type | ||
| self.rows = rows | ||
| self.columns = columns | ||
| @dataclass |
hashhar
reviewed
Jan 19, 2023
|
|
||
| if self._query is not None and self._query.update_count is not None: | ||
| return self._query.update_count | ||
| return -1 |
Member
There was a problem hiding this comment.
This is not obvious so maybe a link to https://peps.python.org/pep-0249/#rowcount here would be useful i.e. the -1 is what the DB-API requires.
10edf59 to
d0b3ba1
Compare
damian3031
approved these changes
Jan 19, 2023
d0b3ba1 to
f8f9aa8
Compare
hashhar
approved these changes
Jan 20, 2023
Member
hashhar
left a comment
There was a problem hiding this comment.
Lgtm. The comment doesn't need to be addressed in this PR, it's just a question.
| assert cur.description[0][6] is None | ||
|
|
||
|
|
||
| class _TestTable: |
Member
There was a problem hiding this comment.
Should we have a utils module under test directory? I see some other such classes and methods which we be useful across tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Resolves #319
Non-technical explanation
Release notes
( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
(x) Release notes are required, with the following suggested text:
* Provide row count on dbapi's Cursor for DML queries