2012-11-27 69 views
1

我怎麼能拿InstrumentedAttribute對象的值中的SQLAlchemy:取的SQLAlchemy的值instrumentedattribute

(Pdb) ResultLine.item_reference_1 
<sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x793dc90> 

上述語句打印我SQLAlchemy的對象。

我真正需要的是與之相關的價值。

回答

4

沒有任何價值與InstrumentedAttribute;您正在查看聲明,而不是結果集。例如,InstrumentedAttribute用於定義與另一個表的關係。

查詢數據庫中的結果,並將得到的對象將有您填寫參考:

for res in session.query(ResultLine).filter(somefilter): 
    print res.item_reference_1