Created
October 12, 2018 10:58
-
-
Save hieuhani/e955e82df28654a71a0cefca8a0a55cf to your computer and use it in GitHub Desktop.
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
result = db.session.execute( | |
db | |
.update(Contact, values={'value': payload['value']}, returning=Contact.__table__.columns) | |
.where(Contact.id == payload['id']) | |
) | |
db.session.commit() | |
fetched_data = result.first() | |
contact = {} | |
for (index, column) in enumerate(result.keys()): | |
contact[column] = fetched_data[index] | |
return Contact(**contact) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment