Skip to content
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

gh-101117: Improve accuracy of sqlite3.Cursor.rowcount docs #104287

Conversation

erlend-aasland
Copy link
Contributor

@erlend-aasland erlend-aasland commented May 8, 2023

The SQLite C API sqlite3_changes() can only be relied upon when the
statment has been run to completion.


📚 Documentation preview 📚: https://cpython-previews--104287.org.readthedocs.build/

The SQLite C API sqlite3_changes() can only be relied upon when the
statment has been run to completion.
@erlend-aasland
Copy link
Contributor Author

@rt121212121, would this docs update be an improvement?

@rt121212121
Copy link

As a developer in the Python ecosystem I have had more breaking changes than I would like in both standard library modules and core tools like the packaging tools, this is the third recently. Each of these is regrettable and incurs both unwanted work and confusion.

Documentation would be good. I would recommend that all breaking changes are clearly and explicitly documented, both in what's new and in the library documentation. I understand that you have a lot of demands on your time, so that would be appreciated.

Personally, I would break this further. I would have the rowcount error if the problem case is encountered, rather than being incorrect. But that is asking someone to do more work, and that someone is not going to be myself.

@erlend-aasland
Copy link
Contributor Author

As a developer in the Python ecosystem I have had more breaking changes than I would like in both standard library modules and core tools like the packaging tools, this is the third recently. Each of these is regrettable and incurs both unwanted work and confusion.

I understand your frustration, and thank you for speaking up. Note that we really strive to avoid these kinds of changes; backwards compatibility is a priority. Unfortunately, as I wrote on the issue, we sometimes take the wrong step. In this case, the backwards compatibility issues were not immediately obvious.

Documentation would be good. I would recommend that all breaking changes are clearly and explicitly documented, both in what's new and in the library documentation. I understand that you have a lot of demands on your time, so that would be appreciated.

All known breaking changes are always documented, both in the changelog (NEWS entries) and in What's New. We've also introduced a new category in What's New for pending breaking changes, in order to better prepare users of stuff like deprecated APIs being removed in a future version. Of course, this implies that we know that a change is a breaking change; this was unfortunately not the case for the changes that lead to your specific problem here. IMO, the best we can do now, is to improve the existing documentation, which is what I'm trying to do with this PR.

Personally, I would break this further. I would have the rowcount error if the problem case is encountered, rather than being incorrect. But that is asking someone to do more work, and that someone is not going to be myself.

That is a slight change in the existing semantics of rowcount, so we'd have to think that through very carefully, as it may be another breaking change. For the sake of stability, I'd prefer to keep the status quo, and simply document how to use the APIs.

@miss-islington
Copy link
Contributor

Thanks @erlend-aasland for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@erlend-aasland erlend-aasland deleted the docs/sqlite-returning-clauses-and-rowcount branch May 11, 2023 08:44
@miss-islington
Copy link
Contributor

Sorry @erlend-aasland, I had trouble checking out the 3.11 backport branch.
Please retry by removing and re-adding the "needs backport to 3.11" label.
Alternatively, you can backport using cherry_picker on the command line.
cherry_picker 7470321f8171dce96a604ba2c24176837f999ca0 3.11

@erlend-aasland
Copy link
Contributor Author

Thanks for the review, Alex, and thanks for your input Roger.

erlend-aasland added a commit to erlend-aasland/cpython that referenced this pull request May 11, 2023
…ocs (python#104287)

The SQLite C API sqlite3_changes() can only be relied upon when the
current active statement has been run to completion.
@bedevere-bot
Copy link

GH-104381 is a backport of this pull request to the 3.11 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label May 11, 2023
erlend-aasland added a commit that referenced this pull request May 11, 2023
…104287) (#104381)

The SQLite C API sqlite3_changes() can only be relied upon when the
current active statement has been run to completion.
carljm added a commit to carljm/cpython that referenced this pull request May 11, 2023
* main: (27 commits)
  pythongh-87849: fix SEND specialization family definition (pythonGH-104268)
  pythongh-101819: Adapt _io.IOBase.seek and _io.IOBase.truncate to Argument Clinic (python#104384)
  pythongh-101819: Adapt _io._Buffered* methods to Argument Clinic (python#104367)
  pythongh-101819: Refactor `_io` futher in preparation for module isolation (python#104369)
  pythongh-101819: Adapt _io.TextIOBase methods to Argument Clinic (python#104383)
  pythongh-101117: Improve accuracy of sqlite3.Cursor.rowcount docs (python#104287)
  pythonGH-92184: Convert os.altsep to '/' in filenames when creating ZipInfo objects (python#92185)
  pythongh-104357: fix inlined comprehensions that close over iteration var (python#104368)
  pythonGH-90208: Suppress OSError exceptions from `pathlib.Path.glob()` (pythonGH-104141)
  pythonGH-102181: Improve specialization stats for SEND (pythonGH-102182)
  pythongh-103000: Optimise `dataclasses.asdict` for the common case (python#104364)
  pythongh-103538: Remove unused TK_AQUA code (pythonGH-103539)
  pythonGH-87695: Fix OSError from `pathlib.Path.glob()` (pythonGH-104292)
  pythongh-104263: Rely on Py_NAN and introduce Py_INFINITY (pythonGH-104202)
  pythongh-104010: Separate and improve docs for `typing.get_origin` and `typing.get_args` (python#104013)
  pythongh-101819: Adapt _io._BufferedIOBase_Type methods to Argument Clinic (python#104355)
  pythongh-103960: Dark mode: invert image brightness (python#103983)
  pythongh-104252: Immortalize Py_EMPTY_KEYS (pythongh-104253)
  pythongh-101819: Clean up _io windows console io after pythongh-104197 (python#104354)
  pythongh-101819: Harden _io init (python#104352)
  ...
carljm added a commit to carljm/cpython that referenced this pull request May 11, 2023
* main:
  pythongh-87849: fix SEND specialization family definition (pythonGH-104268)
  pythongh-101819: Adapt _io.IOBase.seek and _io.IOBase.truncate to Argument Clinic (python#104384)
  pythongh-101819: Adapt _io._Buffered* methods to Argument Clinic (python#104367)
  pythongh-101819: Refactor `_io` futher in preparation for module isolation (python#104369)
  pythongh-101819: Adapt _io.TextIOBase methods to Argument Clinic (python#104383)
  pythongh-101117: Improve accuracy of sqlite3.Cursor.rowcount docs (python#104287)
  pythonGH-92184: Convert os.altsep to '/' in filenames when creating ZipInfo objects (python#92185)
  pythongh-104357: fix inlined comprehensions that close over iteration var (python#104368)
  pythonGH-90208: Suppress OSError exceptions from `pathlib.Path.glob()` (pythonGH-104141)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants