Reputation: 9604
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?
Upvotes: 4
Views: 7874
Reputation: 6602
You need to call .all()
on that query. The object you are getting back is the unmaterialized query.
Upvotes: 11