Skip to main content

Python wrapper to make interacting with SQL databases easy

Project description

A Python based wrapper (meta-wrapper, even) allowing easy MySQL and SQLite interactions.


  • Python 2.7.3 (this is what I test with, should work with most 2.x; 3.x not guaranteed without porting)
  • sqlite3 module (comes with Python installs)
  • Install MySQLdb if you want MySQL support
    • If you’re using a Debian-like distro (Ubuntu, Debian, Crunchbang, etc), install the package python-mysqldb
      • $ sudo apt-get install python-mysqldb
    • There is no pypi package (someone get on this)
    • If that didn’t work, or you’re not using a Debian-like distro:
      • Build and install the MySQLdb module from source.
      • This link explains better than I could.
    • Verify it’s installed: $ python -c 'import MySQLdb'
      • If nothing shows up, you’re good!
      • If you get an ImportError, think, do you really need MySQL?
      • If yes, this is a problem, and I can’t really help. :(
      • If you don’t, just use sqlite, it’s much easier.


  • Install pysqlw: $ pip install pysqlw
  • Import pysqlw:
    • import pysqlw
  • Create a new instance:
    • p = pysqlw.pysqlw(db_type="sqlite", db_path="/home/user/example.db")
    • If you want to use MySQL you need to supply more details:
    • p = pysqlw.pysqlw(db_type="mysql", db_host="localhost", db_user="username", db_pass="password", db_name="database_name")
    • Alternatively, you can use it with Python’s with statement.
  • Documentation is now on the pysqlw readthedocs entry.


If you’re interested, you can write extra meta-wrappers for foreign database types. They’re pretty simple, look at the pysqlw wrappers documentation page for an example.

If there’s not a wrapper for a database type you’d like (that is, an actual wrapper, not just a meta-wrapper), you should make one of those and send in some pull requests with meta-wrappers! More coverage is great.

If you wish to help contribute to the base wrapper functions, feel free to fork the github repo and send in pull requests!

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
pysqlw-1.3.1.tar.gz (6.3 kB) Copy SHA256 hash SHA256 Source None Sep 15, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page