Mysql in Python?

S

Stefan Stolz

Hello,
i tried to find something about mysql in www.python.org, but found
nothing...
What can you recommend to use for getting and putting data from and into a
mysql database?
On my Suse 9.1 i found a rpm python-mysql. In the web i found the hk_classes
from www.knoda.org. This should do also such things.
Can you recommend something? What do you use?
Thank you very much for the info.
 
J

Jeremy Jones

Stefan said:
Hello,
i tried to find something about mysql in www.python.org, but found
nothing...
What can you recommend to use for getting and putting data from and into a
mysql database?
On my Suse 9.1 i found a rpm python-mysql. In the web i found the hk_classes
from www.knoda.org. This should do also such things.
Can you recommend something? What do you use?
Thank you very much for the info.
I have used a MySQLdb module before. Here's a piece of code that I
found lying around my home directory:

import MySQLdb

if __name__ == "__main__":
db_conn =
MySQLdb.connect(host='hostname',db='database_name',user='username',passwd='password')
handle = db_conn.cursor()
query = "SELECT * FROM foo"
handle.execute(query)
Results = handle.fetchall()
print Results

I'm not sure, but I believe that MySQLdb is included in this project:

http://sourceforge.net/projects/mysql-python

(which appears to have been updated only a couple of months back, so
that's good news).
 
S

Stefan Stolz

Jeremy said:
I'm not sure, but I believe that MySQLdb is included in this project:

http://sourceforge.net/projects/mysql-python

(which appears to have been updated only a couple of months back, so
that's good news).
Thank you, but i don`t understand why there is nothing implemented in
Python?

I was a little konfused after reading the doku of mysql-python, because
there the author says its better to use MySQLdb ;-) ?!?!
 
J

Jeremy Jones

Stefan said:
Jeremy Jones wrote:



Thank you, but i don`t understand why there is nothing implemented in
Python?

I was a little konfused after reading the doku of mysql-python, because
there the author says its better to use MySQLdb ;-) ?!?!
So, are you wanting a pure Python module to connect to MySQL? I'm not
sure there are any that exist.

Jeremy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top