Re: JSON from Python mysqldb

2008-08-27 Thread TYR
On Aug 27, 2:37 pm, TYR <[EMAIL PROTECTED]> wrote: > There's always the naive option. > > query = ('species', 'lifestyle', 'coolness', 'tentacles=>8') > db.execute('SELECT %s, %s, %s % FROM creatures WHERE %s;' % query) > record = dict(zip((query), (db.fetchall())) > array = '''{ >              '''

Re: JSON from Python mysqldb

2008-08-27 Thread TYR
There's always the naive option. query = ('species', 'lifestyle', 'coolness', 'tentacles=>8') db.execute('SELECT %s, %s, %s % FROM creatures WHERE %s;' % query) record = dict(zip((query), (db.fetchall())) array = '''{ ''' for k,v in record: array.append('"(k)":"(v)"') array.append('

Re: JSON from Python mysqldb

2008-08-26 Thread jpuopolo
On Aug 26, 3:15 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > jpuopolo wrote: > > All: > > > I am using Python to read some records from the MySQL database. I am > > using the mysqldb library, and things are working well. > > > Now, I would like to pass back the results of the query to a Web-based >

Re: JSON from Python mysqldb

2008-08-26 Thread Larry Bates
jpuopolo wrote: All: I am using Python to read some records from the MySQL database. I am using the mysqldb library, and things are working well. Now, I would like to pass back the results of the query to a Web-based front end, and I would like to use JSON. Is there a library/example of creatin

JSON from Python mysqldb

2008-08-26 Thread jpuopolo
All: I am using Python to read some records from the MySQL database. I am using the mysqldb library, and things are working well. Now, I would like to pass back the results of the query to a Web-based front end, and I would like to use JSON. Is there a library/example of creating a JSON array fro