Fix stringification of database records on Python 3