I’m happy to announce (bit unofficially) the first (alpha) source code release of MySQL Connector/Python. It’s hosted on Launchpad and can be downloaded using the Bazaar client. It’s more a preview as I’m still working on it during free time. Please post comments, bug reports, ideas, critics, etc..
MySQL Connector/Python is a rewrite of the MySQL Protocol in Python. It does not require the C library libmysqlclient, thus no compiling. However, I’m currently working on making a version which will be linked with the MySQL libraries, for performance.
Small, silly example:
import mysql.connector
db = mysql.connector.
Connect(host='localhost')
cursor = db.cursor()
stmt = "SELECT VERSION()"
cursor.execute(stmt)
row = cursor.fetchone()
print row
db.close()
Comments
Also, what optional features (such as .lastrowid) do you support?
Yes, it should be DB API 2.0 compliant. If not, leave a bug report and I'll address it :)
I'll look at the lastrowid thing.
what changes i hv to make in this line db = mysql.connector.Connect(host=‘localhost’)cursor = db.cursor()
if my client and server are on diffrent machines?? this will work only when they both are on same m/c