Python 获取SQLalchemy instrumentedattribute的值
如何在SQLalchemy中获取Python 获取SQLalchemy instrumentedattribute的值,python,sqlalchemy,Python,Sqlalchemy,如何在SQLalchemy中获取InstrumentedAttribute对象的值: (Pdb) ResultLine.item_reference_1 <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x793dc90> (Pdb)ResultLine.item_reference_1 上面的语句向我打印sqlalchemy对象 我实际需要的是与之关联的值。没有与InstrumentedAttribute关联
InstrumentedAttribute
对象的值:
(Pdb) ResultLine.item_reference_1
<sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x793dc90>
(Pdb)ResultLine.item_reference_1
上面的语句向我打印sqlalchemy对象
我实际需要的是与之关联的值。没有与
InstrumentedAttribute关联的值。
;您看到的是表声明,而不是结果集<例如,代码>InstrumentedAttribute用于定义与另一个表的关系
查询数据库中的结果,结果对象将为您填写引用:
for res in session.query(ResultLine).filter(somefilter):
print res.item_reference_1