Common Table Expressions Simple Example Complex Example Recursive CTEs Common Table Expressions Peewee supports the inclusion of common table expressions (CTEs) in all types...
Working with existing databases Working with existing databases If you already have a database, you can autogenerate peewee models using pwiz, a model generator . For instance,...
Hacks Optimistic Locking Top object per group Top N objects per group Postgres lateral joins Window functions Other methods Writing custom functions with SQLite Hacks Co...
Counting records Counting records You can count the number of rows in any select query: >>> Tweet . select (). count () 100 >>> Tweet . select (). where ( Tweet . id ...
Postgresql Extensions JSON Support hstore support Using hstore Interval support Server-side cursors Full-text search postgres_ext API notes Postgresql Extensions The pos...
Atomic updates Upsert Atomic updates Peewee allows you to perform atomic updates. Let’s suppose we need to update some counters. The naive approach would be to write something...
Filtering records More query examples Filtering records You can filter for particular records using normal python operators. Peeweesupports a wide variety of query operators ....
Patches Patches Do you have an idea for a new feature, or is there a clunky API you’d like toimprove? Before coding it up and submitting a pull-request, open a new issue on Gi...