5

I'm looking for a tool to use MySQL with Python 2.7 under Windows 7 64 bits.

I searched a little bit a found these :

MySQLdb - _http://sourceforge.net/projects/mysql-python/ 
SQLAlchemy - _http://www.sqlalchemy.org/ 
SQLObject - _http://sqlobject.org/ 
ourSQL - _http://pythonhosted.org/oursql/ 
Connector/Python - _http://dev.mysql.com/downloads/connector/python/1.0.html 
SQLite - _http://www.sqlite.org/ 
Psycopg2 - _http://wiki.postgresql.org/wiki/Psycopg2_Tutorial (postgreSQL)
pandaSQL - _https://github.com/yhat/pandasql 
python-sql - _https://code.google.com/p/python-sql/ 
SnakeSQL - http://pythonweb.org/projects/snakesql/

What do you recommend ?

Thanks !

Antoine

Elbbard
  • 2,064
  • 6
  • 30
  • 53
  • 2
    I recommend you to ask in english so the community can help you – Darwing Sep 19 '13 at 06:41
  • Can I ask what OS do you use to develop this? Windows/Mac/Linux/? – Romans 8.38-39 Sep 19 '13 at 07:25
  • I'm using Windows 7 64bits – Elbbard Sep 19 '13 at 07:27
  • MySQLdb - http://sourceforge.net/projects/mysql-python/ because it's commonly used and the documentation is complete. If you encounter any problems, you can google it and find the answer easily most of the time. I've been using MySQL-Python for my Django-Python Project and so far no problems with it. BUT, this is the problem when installing mysql-python in windows 7 64bit (as I've faced this problem long time ago) --> read this http://stackoverflow.com/questions/12702146/mysql-for-python-2-7-says-python-v2-7-not-found Hopefully it gives you some thoughts :D Cheers – Romans 8.38-39 Sep 19 '13 at 07:36

2 Answers2

11

Its important to know what you are searching for and the results you pasted:

  • MySQLdb - this is a Python driver for MySQL. This is a requirement to use MySQL with Python.
  • SQLAlchemy - this in an object relational mapper. A library used to define database objects in code. By itself, this library cannot connect to any database.
  • SQLObject - this is an alternate object relational mapper.
  • ourSQL - an alternate database driver for MySQL to be used in Python.
  • Connector/Python - a driver for Python from the developers of MySQL.
  • SQLite - this is a file-based database, and has nothing to do with MySQL. Libraries for sqlite are bundled with Python.
  • Psycopg2 - this is a driver for postgreSQL, a different database.
  • pandaSQL - this has nothing to do with MySQL but is rather a component for the pandas library.
  • python-sql, this library is only for SQL statements and nothing to do with MySQL.
  • SnakeSQL - this is a database written in Python.

Of what you have searched, the recommended library is MySQLdb.

Burhan Khalid
  • 169,990
  • 18
  • 245
  • 284
  • Thank you very much ! So i'll probably use MySQLdb, is there any other good drivers that you recommend ? – Elbbard Sep 19 '13 at 08:37
  • `MySQLdb` is the driver. – Burhan Khalid Sep 19 '13 at 08:42
  • https://pypi.python.org/pypi/MySQL-python/1.2.4 for Windows 32bits, but you can manipulate for 64bits (as there is no 64bits version) using this trick --> http://stackoverflow.com/questions/12702146/mysql-for-python-2-7-says-python-v2-7-not-found (I've successfully applied it) – Romans 8.38-39 Sep 19 '13 at 08:49
  • You can download Windows installers for many Python libraries (including both 64bit and 32bit version of `mysql-python`) from [this website](http://www.lfd.uci.edu/~gohlke/pythonlibs/). It does not matter what version Windows is, it matters what version of _Python_ you are running. So if you have 32 bit Python on 64 bit Windows, download the 32 bit libraries for Python. – Burhan Khalid Sep 19 '13 at 08:51
  • Unfortunately, that's no longer true anymore. Windows installers have been replaced with wheel (.whl) files. – Seth Connell Apr 01 '18 at 01:58
2

Try PyMySQL if you want easy installation. It doesn't require any native libraries, its pure python implementation. I wouldn't call it revolutionary or awesome, it just works ;).

antonone
  • 2,045
  • 1
  • 25
  • 35