hi, On Tue, Oct 02, 2018 at 04:14:45PM +0100, Tony van der Hoff wrote: > I'm writing a database application, in python 3,5 under Debian9. > > My code: > > def get_albums(self, parent_id = 0 ): > cursor = self.cnx.cursor()
cursor = self.cnx.cursor(pymysql.cursors.DictCursor) > sql =( "select" > " id" > ", parent_id" > ", title" > ", ifnull( description, '' )" > ", path" > ", date( from_unixtime( date_created ) ) as date" > " from album" > " where parent_id = %(parent_id)s" > " order by date_created" > ) sql = ("""SELECT id, parent_id, ... """) > cursor.execute( sql, {'parent_id': parent_id } ) > rows = cursor.fetchall() now rows will looks like this: ({'id':...,...},{'id':...,}...) a. -- https://mail.python.org/mailman/listinfo/python-list