Mysql in Python?

Jeremy Jones zanesdad at
Thu Aug 26 20:05:58 CEST 2004

Stefan Stolz wrote:

>i tried to find something about mysql in, but found
>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 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 = 
    handle = db_conn.cursor()
    query = "SELECT * FROM foo"
    Results = handle.fetchall()
    print Results

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

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

More information about the Python-list mailing list