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 from a mysqldb row or row set?
Thanks,
jpuopolo 4 5030
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
creating a JSON array from a mysqldb row or row set?
Thanks,
jpuopolo
Google turns up several high quality links, just look for 'python json'.
-Larry
On Aug 26, 3:15*pm, Larry Bates <larry.ba...@vitalEsafe.comwrote:
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
creating a JSON array from a mysqldb row or row set?
Thanks,
jpuopolo
Google turns up several high quality links, just look for 'python json'.
-Larry
Larry:
Thank you for the reply. Unfortunately, some of the libs the Google
search returns bail when
converting a database record into a JSON object. I may be using it/
them incorrectly, so I'll post
results to this newsgroup accordingly.
Best,
John
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('''
}''')
On Aug 27, 2:37*pm, TYR <a.harrow...@gmail.comwrote:
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('''
* * * * * * * * }''')
Actually, don't.
query = ('species', 'lifestyle', 'coolness')
limit = ('tentacles=>8') This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Igor Prischepoff |
last post by:
Hi,
Is someone have an expierience in distributing
python app with mysqldb module on Win platforms?
I'd like to know, how you packaged and delivered your solution.
Which tool to use, how to...
|
by: sandy |
last post by:
Hi All,
I am a newbie to MySQL and Python. At the first place, I would like to
know what are the general performance issues (if any) of using MySQL
with Python.
By performance, I wanted to...
|
by: ajikoe |
last post by:
Hello I need to build table which need searching data which needs more
power then dictionary or list in python, can anyone help me what kind
of database suitable for python light and easy to learn....
|
by: Aquarius |
last post by:
I appologize in advance for this strange (and possibly stupid)
question.
I want to know if there is a way to interface a MySQL database without
Python-MySQL or without installing anything that...
|
by: Cousin Stanley |
last post by:
Greetings ....
I'm using a commercial web host running FreeBSD
that fortunately has Python and MySQL,
but no python-mysqldb module ....
Before begging the host to install it
I thought I...
|
by: Fred |
last post by:
I hope someone can help me with the below problem...
Thanks,
Fred
My enviroment:
--------------------------
Slackware Linux 10.2
Python 2.4.2
MySql version 4.1.14
|
by: jgarber |
last post by:
Hello,
I just upgraded MySQLdb to the 1.2.0 version provided by Redhat
Enterprise Linux ES4. At that point I began to get segfaults when
importing twisted after MySQLdb, but not before.
--...
|
by: Mark Tarver |
last post by:
How do you compare Python to Lisp? What specific advantages do you
think that one has over the other?
Note I'm not a Python person and I have no axes to grind here. This is
just a question for...
|
by: Gerard M |
last post by:
Hi guys I have a big problem with this wrapper im using Ubuntu 7.04
and I want to install python-MySQLdb, I used synaptics and it is
installed, but when I try to do
and I get this error:
...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM).
In this month's session, the creator of the excellent VBE...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Aftab Ahmad |
last post by:
Hello Experts!
I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
| |