I'm searching for a record in Users db and then looping through all the records. The code is something like below.
email = "[email protected]"
data = Users.query.filter(email=email).first()
for item in data:
if item["age"] == 15:
#do something
The above code throws error Users object not iterable. How can I loop through the records?
first, so there is ONE item, nothing to iterate on, what did you expect ?Users.query.filter(email=email).all()?