“Unprintable InterfaceError” in SQLAlchemy

I was working on Horlu when I encountered this frustrating situation. It took me a few hours to find out what happened because of the error message Unprintable InterfaceError doesn’t give me any clue where to look into. :(

I was trying to assign some data from request.post into an ORM object. Instead of using request.post.to_dict(), I used dict(request.post) which converted all the values into a list and assigned to theString fields of the ORM object. So if you ever encounter a “strange” error message Unprintable InterfaceError SQLAlchemy, it is very likely you tried to save some unsupported/mismatched data type into the database.

Hope this will save you a couple hours.

Like what you read? Give Shang Liang a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.