I am trying too update the JSON datatype column of postgresql table using Sqlalchemy binaryexpression in python.
Example
unit_price = 10.10
final_data = {
"price_details": {
"unit_price":unit_price,
"total_amt":testmodel.qty * unit_price
}
}
test_db = session.query(testmodel).filter(testmodel.id >= 10)
test_db.update(final_data,synchronize_session=False)
In above example i am trying to calculate total_amt using binaryexpression. But I am getting error.
StatementError: (exceptions.TypeError) <sqlalchemy.sql.elements.BinaryExpression object at 0x6024810> is not JSON serializable