Fields Field types table Field initialization arguments Some fields take special parameters… Default field values ForeignKeyField ForeignKeyField Back-references DateTimeFiel...
Database Working with existing databases Database We’re done with our database, let’s close the connection: db . close () In an actual application, there are some establis...
Create or get Create or get Peewee has one helper method for performing “get/create” type operations: Model.get_or_create() , which first attempts to retrieve the matching row...
MySQL Extensions MySQL Extensions Peewee provides an alternate database implementation for using the mysql-connector driver. The implementation can be found in playhouse.mysql...
Counting records Counting records You can count the number of rows in any select query: >>> Tweet . select (). count () 100 >>> Tweet . select (). where ( Tweet . id ...
Create or get Create or get Peewee has one helper method for performing “get/create” type operations: Model.get_or_create() , which first attempts to retrieve the matching row...