]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Allow overriding @validates for inheritance
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 9 Jul 2026 20:44:16 +0000 (16:44 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 11 Jul 2026 17:14:12 +0000 (13:14 -0400)
commit5bf558aa45a03d7bb6364e07e7d8fff5b92158ab
tree4ebce3176824a02e8aa7d6c5298a60b0828b7364
parent117851648a21cf6cb12430df33913f200a090100
Allow overriding @validates for inheritance

When a subclass overrides a :func:`_orm.validates` method using the
same method name as the parent class, only the subclass validator is
now invoked for instances of the subclass.  The subclass validator
may call ``super()`` to also invoke the parent class validator.
Previously, the parent validator was always used regardless of
whether the subclass provided an override.  Pull request courtesy
Indivar Mishra.

as an aside, also sets -j auto for the sphinx autobuild
utility in the makefile, seems to work.  I would assume this was
not working when I originally added this option.

Fixes: #2943
Closes: #10574
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10574
Pull-request-sha: d310bef35b0ac3e5b840842b62807fc4008fd086

Change-Id: If0dab1ce5d93dbba4686d9cab36b81f6a79bfc1e
doc/build/Makefile
doc/build/changelog/unreleased_21/2943.rst [new file with mode: 0644]
doc/build/orm/mapped_attributes.rst
lib/sqlalchemy/orm/mapper.py
lib/sqlalchemy/orm/strategies.py
test/orm/test_validators.py