]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Fix typing to ensure that InstrumentedAttribute is hashable
authorFederico Caselli <cfederico87@gmail.com>
Sat, 16 Sep 2023 09:06:17 +0000 (11:06 +0200)
committerFederico Caselli <cfederico87@gmail.com>
Sun, 17 Sep 2023 17:33:53 +0000 (19:33 +0200)
commit8a3bcd9af491b8a4737ce33e6dd96500342967d3
tree30b9c3386aa8d0791e47a7d494feec924f7fae20
parentf662dfc9d93f89ec16f87348ccf34af3b3d684da
Fix typing to ensure that InstrumentedAttribute is hashable

Repaired the core "SQL element" class ``SQLCoreOperations`` to support the
``__hash__()`` method from a typing perspective, as objects like
:class:`.Column` and ORM :class:`.InstrumentedAttribute` are hashable and
are used as dictionary keys in the public API for the :class:`_dml.Update`
and :class:`_dml.Insert` constructs.  Previously, type checkers were not
aware the root SQL element was hashable.

Fixes: #10353
Change-Id: I3c8eeb7ceb29a3087596e17d09aa6a7f45a8cf99
doc/build/changelog/unreleased_20/10353.rst [new file with mode: 0644]
lib/sqlalchemy/sql/elements.py
lib/sqlalchemy/sql/operators.py
test/typing/plain_files/orm/typed_queries.py
test/typing/plain_files/sql/common_sql_element.py
test/typing/plain_files/sql/dml.py