diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-03-21 13:32:41 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-03-21 13:33:09 -0400 |
commit | c8fb843a2d92e5d8d2271d46ddde02a2c79ee94c (patch) | |
tree | d50cce870c4226d9f7989fc4e3afe3acfa4b7fce /lib/sqlalchemy/orm/attributes.py | |
parent | fa0666cb04174cdd2592ab1327d48e431fe86ffa (diff) | |
download | sqlalchemy-c8fb843a2d92e5d8d2271d46ddde02a2c79ee94c.tar.gz |
return None for no parententity on Proxy
Fixed regression where accessing the expression value of a hybrid property
on a class that was either unmapped or not-yet-mapped (such as calling upon
it within a :func:`_orm.declared_attr` method) would raise an internal
error, as an internal fetch for the parent class' mapper would fail and an
instruction for this failure to be ignored were inadvertently removed in
2.0.
Fixes: #9519
Change-Id: If195d26a5ddd2312a373004eb7a1403e1d11e7a4
Diffstat (limited to 'lib/sqlalchemy/orm/attributes.py')
-rw-r--r-- | lib/sqlalchemy/orm/attributes.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index f33364c62..3a60eda4f 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -611,11 +611,11 @@ def create_proxied_attribute( @property def _parententity(self): - return inspection.inspect(self.class_) + return inspection.inspect(self.class_, raiseerr=False) @property def parent(self): - return inspection.inspect(self.class_) + return inspection.inspect(self.class_, raiseerr=False) _is_internal_proxy = True |