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 5061
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...@vi talEsafe.comwro te:
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('SEL ECT %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...@gm ail.comwrote:
There's always the naive option.
query = ('species', 'lifestyle', 'coolness', 'tentacles=>8')
db.execute('SEL ECT %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 install ?
In source or binary form?
--
Igor.
|
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 know how will the speed be, what is the
memory overhead involved, etc during database specific operations
(retrieval, update, insert, etc) when MySQL is used with Python.
|
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. Is mySQL a
nice start with python ?
Sincerely Yours,
Pujo
|
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 has C files that need
to be compiled. The reason for this, is that I want to develop a
certain web application, but my hosting provider (!#@$!@#%) isn't very
eager to supply Python-MySQL (or any modules to python). Is there an
alternative approach...
|
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 would try the Debian version
that I have on the outside chance
that it might fly directly under FreeBSD
| |
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.
--
RedHat Enterprise Linux ES 4 (fully updated)
Python 2.3.4
mysql-python (MySQLdb) version 1.2.0
|
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 my general education.
Mark
|
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:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "MySQLdb/__init__.py", line 19, in <module>
import _mysql
ImportError: No module named _mysql
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |