How can I fetch the value of a InstrumentedAttribute
object in SQLalchemy:
(Pdb) ResultLine.item_reference_1
<sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x793dc90>
The above statement prints me the sqlalchemy object.
What I actually need is the value associated with it.
There is no value associated with an InstrumentedAttribute
; you are looking at a table declaration, not a result set. InstrumentedAttribute
is used to define a relationship to another table, for example.
Query the database for results, and the resulting objects will have the reference filled in for you:
for res in session.query(ResultLine).filter(somefilter):
print res.item_reference_1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With