-
Notifications
You must be signed in to change notification settings - Fork 197
Provide rowcount for DML queries #325
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
Conversation
hovaesco
left a comment
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.
LGTM % one comment
| 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: |
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.
The comment above can be updated to reflect the change.
| self.update_type = update_type | ||
| self.rows = rows | ||
| self.columns = columns | ||
| @dataclass |
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.
Very nice. ❤️
|
|
||
| if self._query is not None and self._query.update_count is not None: | ||
| return self._query.update_count | ||
| return -1 |
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.
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.
hashhar
left a comment
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.
LGTM % outdated comment
10edf59 to
d0b3ba1
Compare
d0b3ba1 to
f8f9aa8
Compare
hashhar
left a comment
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.
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: |
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.
Should we have a utils module under test directory? I see some other such classes and methods which we be useful across tests.
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