Peewee is a small, expressive Object Relational Mapper (ORM) for Python that provides a simple and efficient way to interact with databases. It supports SQLite, MySQL, and PostgreSQL out of the box. Peewee lets you define database models as Python classes and perform queries using Pythonic syntax, making database management much easier and cleaner. It’s perfect for small to medium projects where you need database functionality without the overhead of larger ORMs like SQLAlchemy or Django ORM.
Installation:
pip install peewee
Example usage:
from peewee import *
db = SqliteDatabase("people.db")
class Person(Model):
name = CharField()
age = IntegerField()
class Meta:
database = db
db.connect()
db.create_tables([Person])
Person.create(name="Alice", age=25)
for person in Person.select():
print(person.name, person.age)
PyPI page: https://pypi.org/project/peewee/
GitHub page: https://github.com/coleifer/peewee
3 Project Ideas:
- Build a personal expense tracker with a local SQLite database.
- Create a desktop app for managing contacts or inventory.
- Develop a lightweight blog or notes app with user authentication.
Top comments (0)