flask-sqlalchemy
flask-sqlalchemy copied to clipboard
Rename `first_or_404` and `one_or_404` to `scalar_or_404` and `scalar_one_or_404`
The underly implementation of first_or_404 and one_or_404 is use scalar() and scalar_one(). I think it will be more clear to rename them to scalar_or_404 and scalar_one_or_404, so users won't expect or worry first_or_404 and one_or_404 will return a Row object/tuple.
It seems reasonable to change the old names to match the new behaviors of SQLAlchemy 2.x style. The old names can be kept for backward compatibility.
I will add the tests, and update the docs if this change will be accepted.
Checklist:
- [ ] Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
- [ ] Add or update relevant docs, in the docs folder and in code.
- [ ] Add an entry in
CHANGES.rstsummarizing the change and linking to the issue. - [x] Add
.. versionchanged::entries in any relevant code docs. - [x] Run
pre-commithooks and fix any issues. - [x] Run
pytestandtox, no tests failed.