Last active
November 23, 2023 14:38
-
-
Save victory-sokolov/53420b2ff18d9db5d0bd75b9c8aa9642 to your computer and use it in GitHub Desktop.
Convert SQLAlchemy object to Python dictionary
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
users = User.query.filter_by(id=id).first() | |
users = [] | |
for user in users: | |
dictret = dict(receipt.__dict__) | |
dictret.pop('_sa_instance_state', None) | |
users.append(dictret) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment