The Python Database API (DB-API) defines a standard interface for Python database access modules. It’s documented in PEP 249. Nearly all Python database modules such as sqlite3, psycopg and mysql-python conform to this interface.

Tutorials that explain how to work with modules that conform to this interface can be found here and here.


SQLAlchemy is a commonly used database toolkit. Unlike many database libraries it not only provides an ORM layer but also a generalized API for writing database-agnostic code without SQL.

$ pip install sqlalchemy

Django ORM

The Django ORM is the interface used by Django to provide database access.

It’s based on the idea of models, an abstraction that makes it easier to manipulate data in Python.

The basics:

  • Each model is a Python class that subclasses django.db.models.Model.
  • Each attribute of the model represents a database field.
  • Django gives you an automatically-generated database-access API; see Making queries.

Python Guide.

This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis.

Get Updates

Receive updates on new releases and upcoming projects.

Subscribe to Newsletter


If you enjoy this guide, consider supporting the author on Gittip:

Table Of Contents

Related Topics

This Page

Fork me on GitHub