accounts = db.query(models.MyModel).filter(models.MyModel.id == user_id)
print(accounts)
results in
<sqlalchemy.orm.query.Query object at 0x1dbafd0>,
I expected a list or something of MyModel but i get back an object query. How can I get a list of MyModel instead?
You need to call .all()
on that query. The object you are getting back is the unmaterialized query.
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