-
Notifications
You must be signed in to change notification settings - Fork 29
Databases
Python interacts with database backends using various database interfaces, or APIs. There are different database APIs for each type of database, whether you're dealing with MySQL, Postgres, Oracle, SQLite, etc. Most of these APIs conform to a common standard known as the Python DB-API 2.0. This standardization means that you can use the same Python syntax to query databases, regardless of which API and database back end you're using. There are some minor exceptions, but on the whole the syntax is pretty uniform across the board.
If the developers of the official database API don't offer a version that works with your operating system and/or version of Python, you can try searching for unofficial binaries at sites like the below. Be warned that these are not officially supported, documented, etc.
- Unofficial Windows binaries for various versions of Python, includes binaries for MySQL, Postgres, SQL Server, and others.
python-mysqldb is Python's primary database adapter for MySQL. Unfortunately, as of February 2011, it only supported Python versions 2.3-2.6. There are various unofficial binaries floating around for newer Python versions, so those might be worth a try.
Installing python-mysqldb can be tricky, especially on Windows. Below are some links that might be useful.
- Unofficial Windows binaries, includes python-mysqldb binaries for Python 2.3-3.2 for 32-bit and 64-bit operating systems
- Windows installers for python-mysqldb
pyodbc is a library that creates connections not just to SQL Server but several other databases as well.