peewee
Peewee is a simple and small ORM. It has few (but expressive) concepts, making it easy to learn and intuitive to use.
- a small, expressive ORM
- python 2.7+ and 3.4+ (developed with 3.6)
- supports sqlite, mysql, postgresql and cockroachdb
- tons of extensions
Peewee’s source code hosted on GitHub.
New to peewee? These may help:
- Quickstart
- Example twitter app
- Using peewee interactively
- Models and fields
- Querying
- Relationships and joins
Contents:
- Installing and Testing
- Quickstart
- Example app
- Using Peewee Interactively
- Contributing
- Database
- Initializing a Database
- Using Postgresql
- Using CockroachDB
- Using SQLite
- Using MySQL
- Connecting using a Database URL
- Run-time database configuration
- Dynamically defining a database
- Setting the database at run-time
- Thread-Safety and Multiple Databases
- Connection Management
- Connection Pooling
- Testing Peewee Applications
- Async with Gevent
- Framework Integration
- Executing Queries
- Managing Transactions
- Database Errors
- Logging queries
- Adding a new Database Driver
- Models and Fields
- Querying
- Creating a new record
- Bulk inserts
- Updating existing records
- Atomic updates
- Deleting records
- Selecting a single record
- Create or get
- Selecting multiple records
- Filtering records
- Sorting records
- Getting random records
- Paginating records
- Counting records
- Aggregating records
- Retrieving Scalar Values
- Window functions
- Retrieving row tuples / dictionaries / namedtuples
- Returning Clause
- Common Table Expressions
- Foreign Keys and Joins
- Query operators
- Relationships and Joins
- API Documentation
- SQLite Extensions
- Playhouse, extensions to Peewee
- Sqlite Extensions
- SqliteQ
- Sqlite User-Defined Functions
- apsw, an advanced sqlite driver
- Sqlcipher backend
- Postgresql Extensions
- Cockroach Database
- MySQL Extensions
- DataSet
- Fields
- Hybrid Attributes
- Key/Value Store
- Shortcuts
- Signal support
- pwiz, a model generator
- Schema Migrations
- Reflection
- Database URL
- Connection pool
- Test Utils
- Flask Utils
- Query Examples
- Query Builder
- Hacks
- Changes in 3.0
Note
If you find any bugs, odd behavior, or have an idea for a new feature please don’t hesitate to open an issue on GitHub or contact me.