Don't include LargeBinary properties in default colander schema

actually, exclude any found in secondary properties...i.e. from relationship
This commit is contained in:
Lance Edgar 2018-10-19 21:17:50 -05:00
parent ed9f8a269c
commit f26f42427f

View file

@ -213,9 +213,17 @@ class CustomSchemaNode(SQLAlchemySchemaNode):
excludes = []
if isinstance(prop, orm.RelationshipProperty):
for next_prop in prop.mapper.iterate_properties:
# don't include secondary relationships
if isinstance(next_prop, orm.RelationshipProperty):
excludes.append(next_prop.key)
# don't include fields of binary type
elif isinstance(next_prop, orm.ColumnProperty):
for column in next_prop.columns:
if isinstance(column.type, sa.LargeBinary):
excludes.append(next_prop.key)
if excludes:
overrides['excludes'] = excludes