Installing and Testing

Install the latest release from PyPI:

pip install peewee

Peewee has an optional Sqlite C extension which is not bundled in the default wheel. It provides user-defined ranking functions for use with Sqlite FTS4 and functions for fuzzy string matching. To build from source:

pip install peewee --no-binary :all:

Installing from Source

git clone https://github.com/coleifer/peewee.git
cd peewee
pip install .

Running Tests

python runtests.py
python runtests.py --help  # Show options.

To run tests against Postgres or MySQL create a database named peewee_test. For the Postgres extension tests, enable hstore:

CREATE EXTENSION hstore;

Supported Drivers

Peewee works with any database for which a DB-API 2.0 driver exists. The following drivers are supported out of the box:

Database

Driver

Implementation

Sqlite

sqlite3

SqliteDatabase

Postgres

psycopg3

PostgresqlDatabase

Postgres

psycopg2

PostgresqlDatabase

MySQL

pymysql

MySQLDatabase

Sqlite (async)

aiosqlite

AsyncSqliteDatabase

Postgres (async)

asyncpg

AsyncPostgresqlDatabase

MySQL (async)

aiomysql

AsyncMySQLDatabase

Sqlite (alternate)

cysqlite

CySqliteDatabase

Sqlite (alternate)

apsw

APSWDatabase

SqlCipher

sqlcipher3

SqlCipherDatabase

MySQL (alternate)

mysql-connector

MySQLConnectorDatabase

MariaDB (alternate)

mariadb-connector

MariaDBConnectorDatabase

CockroachDB

psycopg (2 or 3)

CockroachDatabase

Postgres (extensions)

psycopg (2 or 3)

PostgresqlExtDatabase

The three bolded rows cover the majority of deployments. All others are optional; install their drivers when needed.