diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-08-25 13:12:55 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-08-25 13:15:33 -0400 |
commit | 07b7e1594deecc6c9c64893a63f56403da0dcf05 (patch) | |
tree | ce5eb76781d7d2cdb286a754eb15f07557ae13e5 /lib/sqlalchemy/ext/mypy/decl_class.py | |
parent | 00fe746366d910d9328543a194afb52a115a1837 (diff) | |
download | sqlalchemy-07b7e1594deecc6c9c64893a63f56403da0dcf05.tar.gz |
ensure "sqlalchemy" info set for all considered classes
Fixed issue in mypy plugin where columns on a mixin would not be correctly
interpreted if the mapped class relied upon a ``__tablename__`` routine
that came from a superclass.
Fixes: #6937
Change-Id: I74aed4862d0545008ee67f781aaa794ab6866926
Diffstat (limited to 'lib/sqlalchemy/ext/mypy/decl_class.py')
-rw-r--r-- | lib/sqlalchemy/ext/mypy/decl_class.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/sqlalchemy/ext/mypy/decl_class.py b/lib/sqlalchemy/ext/mypy/decl_class.py index 23c78aa51..b85ec0f69 100644 --- a/lib/sqlalchemy/ext/mypy/decl_class.py +++ b/lib/sqlalchemy/ext/mypy/decl_class.py @@ -61,6 +61,9 @@ def scan_declarative_assignments_and_apply_types( List[util.SQLAlchemyAttribute] ] = util.get_mapped_attributes(info, api) + # used by assign.add_additional_orm_attributes among others + util.establish_as_sqlalchemy(info) + if mapped_attributes is not None: # ensure that a class that's mapped is always picked up by # its mapped() decorator or declarative metaclass before |