Remove some duplicated code

in fact it wasn't exactly duplicate..it had a bug which the shared
function code does not have
This commit is contained in:
Lance Edgar 2022-02-28 12:05:16 -06:00
parent ec2600ddf7
commit 7b485d5ad2

View file

@ -111,22 +111,14 @@ class CustomSchemaNode(SQLAlchemySchemaNode):
for the given association proxy field name. Typically this will refer for the given association proxy field name. Typically this will refer
to the "extension" model class. to the "extension" model class.
""" """
proxy = self.association_proxy(field) return get_association_proxy_target(self.inspector, field)
if proxy:
proxy_target = self.inspector.get_property(proxy.target_collection)
if isinstance(proxy_target, orm.RelationshipProperty) and not proxy_target.uselist:
return proxy_target
def association_proxy_column(self, field): def association_proxy_column(self, field):
""" """
Returns the property on the proxy target class, for the column which is Returns the property on the proxy target class, for the column which is
reflected by the proxy. reflected by the proxy.
""" """
proxy_target = self.association_proxy_target(field) return get_association_proxy_column(self.inspector, field)
if proxy_target:
prop = proxy_target.mapper.get_property(field)
if isinstance(prop, orm.ColumnProperty) and isinstance(prop.columns[0], sa.Column):
return prop
def supported_association_proxy(self, field): def supported_association_proxy(self, field):
""" """