]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Provide special row proxies for count and index
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 17 Mar 2021 12:39:45 +0000 (08:39 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 17 Mar 2021 16:30:22 +0000 (12:30 -0400)
commitaabc72bd33ba445c0a207432acf0aa1cf25263cb
treef7c4608bb4a9a6e8516b4bcc24935bb055711f39
parentecb392c5f927ab117f9704ce373bf2af1dbe5b69
Provide special row proxies for count and index

The Python ``namedtuple()`` has the behavior such that the names ``count``
and ``index`` will be served as tuple values if the named tuple includes
those names; if they are absent, then their behavior as methods of
``collections.abc.Sequence`` is maintained. Therefore the
:class:`_result.Row` and :class:`_result.LegacyRow` classes have been fixed
so that they work in this same way, maintaining the expected behavior for
database rows that have columns named "index" or "count".

Fixes: #6074
Change-Id: I49a093da02f33f231d22ed5999c09fcaa3a68601
doc/build/changelog/unreleased_14/6074.rst [new file with mode: 0644]
lib/sqlalchemy/engine/row.py
test/sql/test_resultset.py