Get json results from mysql with python
This is just simple trick to retrieve data from mysql rows and turn into json. #!/usr/bin/env python import MySQLdb as mdb import sys con = mdb.connect(‘localhost’, ‘root’, ‘pass123’, ‘mydb1′, charset=’utf8’) cur = con.cursor(mdb.cursors.DictCursor) def get_post(): list = [] gw = {} cur.execute(“select * from tbl1_core”) rows = cur.fetchall() for i in rows: tes = [] # … Read more