How to convert SQLAlchemy row object to a Python dict?

You may access the internal __dict__ of a SQLAlchemy object, like the following:

for u in session.query(User).all():
    print u.__dict__

Leave a Comment