如何从字段对象获取父表类?Just.parent
方法不能像预期的那样工作。g、 :
class SomeTable(Base): # Base have 'query' manager field
somefield = Column(...)
def subroutine(field):
table = field.parent # ????
# should work exactly as
# table = SomeTable
table.query.filter(...)
subroutine(SomeTable.somefield)
^{} 返回表示父实体的检查实例,该检查实例是^{} 或^{} 的实例,具体取决于父实体的性质。它不会像您预期的那样直接返回映射类。您可以通过^{} 属性访问映射类:
相关问题 更多 >
编程相关推荐