July 2018
Intermediate to advanced
324 pages
8h 14m
English
Peewee is a simple and small ORM (Object Relational Mapper). It is designed to provide an ORM interface similar to Django or SQLAlchemy. It supports databases such as MySQL, Postgres, and SQLite.
The following is a sample code snippet , from Peewee's GitHub page, for defining model classes:
from peewee import *import datetimedb = SqliteDatabase('my_database.db')class BaseModel(Model): class Meta: database = dbclass User(BaseModel): username = CharField(unique=True)class Tweet(BaseModel): user = ForeignKeyField(User, backref='tweets') message = TextField() created_date = DateTimeField(default=datetime.datetime.now) is_published = BooleanField(default=True)
It's really amazing—we got the feasibility of designing the database ...
Read now
Unlock full access