Is there a MySQL database abstraction layer for Python that works like pyodbc on both Linux and Windows?

I develop on a Windows machine for a Linux server. I'm using pyodbc to connect to MySQL on Windows and was hoping to use MySQLdb to connect to it on my Linux box. I had thought these both implemented the same API and therefore would be compatible. I was very wrong, and now realize that I'll have to re-write all my code to work on Linux, which will subsequently make it not work on Windows.

Is there another thin abstraction layer that would allow me to write more portable code? I was considering SQLAlchemy, but I'm really just trying to execute SQL statements, so learning an entirely new domain specific language seems cumbersome.

Appreciate any recommendations!


SQLAlchemy allows you to issue statements directly

example from the linked page

connection = engine.connect()
result = connection.execute("select username from users")
for row in result:
    print "username:", row['username']

Need Your Help

Read amount of lines from a text file and store them as a constant int for array size c++

c++ arrays inputstream constants

I'm new to C++ and having some problems. Basically what I have to do is read different kinds of text files and use the amount of lines as the size for the rows of a 2-dimensional array.

Save image (print screen) to FTP error?

c# ftp screenshot

Im trying to make a really simple app, to save the current screen to an FTP directory.