diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-04-07 13:57:39 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-04-08 16:06:41 -0400 |
commit | dca3a43de60b064d863abb9b86b1f629fbd4b14d (patch) | |
tree | 09d531c9e0a4b0178343d2942c0e7e6d7d2cf846 /lib/sqlalchemy/testing/warnings.py | |
parent | 4d21920638af4729b6ff09b1ac8c3a20878bd922 (diff) | |
download | sqlalchemy-dca3a43de60b064d863abb9b86b1f629fbd4b14d.tar.gz |
Fix LegacyRow/Row index access
Fixed up the behavior of the :class:`_result.Row` object when dictionary
access is used upon it, meaning converting to a dict via ``dict(row)`` or
accessing members using strings or other objects i.e. ``row["some_key"]``
works as it would with a dictionary, rather than raising ``TypeError`` as
would be the case with a tuple, whether or not the C extensions are in
place. This was originally supposed to emit a 2.0 deprecation warning for
the "non-future" case using :class:`_result.LegacyRow`, and was to raise
``TypeError`` for the "future" :class:`_result.Row` class. However, the C
version of :class:`_result.Row` was failing to raise this ``TypeError``,
and to complicate matters, the :meth:`_orm.Session.execute` method now
returns :class:`_result.Row` in all cases to maintain consistency with the
ORM result case, so users who didn't have C extensions installed would
see different behavior in this one case for existing pre-1.4 style
code.
Therefore, in order to soften the overall upgrade scheme as most users have
not been exposed to the more strict behavior of :class:`_result.Row` up
through 1.4.6, :class:`_result.LegacyRow` and :class:`_result.Row` both
provide for string-key access as well as support for ``dict(row)``, in all
cases emitting the 2.0 deprecation warning when ``SQLALCHEMY_WARN_20`` is
enabled. The :class:`_result.Row` object still uses tuple-like behavior for
``__contains__``, which is probably the only noticeable behavioral change
compared to :class:`_result.LegacyRow`, other than the removal of
dictionary-style methods ``values()`` and ``items()``.
Also remove filters for result set warnings.
callcounts updated for 2.7/ 3.9, am pushing jenkins to use python 3.9
now
Fixes: #6218
Change-Id: Ia69b974f3dbc46943c57423f57ec82323c8ae63b
Diffstat (limited to 'lib/sqlalchemy/testing/warnings.py')
-rw-r--r-- | lib/sqlalchemy/testing/warnings.py | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/lib/sqlalchemy/testing/warnings.py b/lib/sqlalchemy/testing/warnings.py index 5699cd035..3236ecf89 100644 --- a/lib/sqlalchemy/testing/warnings.py +++ b/lib/sqlalchemy/testing/warnings.py @@ -60,10 +60,6 @@ def setup_filters(): # r".*DefaultGenerator.execute\(\)", # # - # result sets - # - r"The Row.keys\(\) method", - r"Using non-integer/slice indices on Row ", # # Core SQL constructs # |