snippets with tag 'MySQL'

Django : DictCursor for raw sql using djangothis has been removed from django trunk because of unused, but maybe useful.
# inspired from old django code
# mimics MySQLdb.cursors.DictCursor behaviour

def dictfetchall(cursor): 
    "Returns all rows from a cursor as a dict" 
    desc = cursor.description 
    return [dict(zip([col[0] for col in desc], row))   for row in cursor.fetchall()]
tags : python, django, MySQL

SQL : Django+MySQL collation problems
ALTER DATABASE `mydbname` DEFAULT CHARACTER SET utf8 COLLATE 'utf8_unicode_ci';
tags : django, MySQL

all tags : python, system, vlc, video, apache, proxy, linux, django, MySQL, .NET, XML, XSL, regexp, bat, windows, bash, git

back to snippets home
site réalisé et hébergé par revolunet © 2009 - informations légales