peewee Documentation
Release 0.9.7Example app . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.5 Model API (smells like django) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2010-01-01 00:00:00 2011-06-07 14:08:48 2011-06-07 14:12:57 >>> for e in Entry.select().order_by(peewee.desc(’pub_date’)): ... print e.pub_date ... 2011-06-07 14:12:57 2011-06-07 14:08:48 2010-01-01 00:00:00 order_by(’id’).paginate(2, 10): ... print entry.title ... entry 10 entry 11 entry 12 entry 13 entry 14 entry 15 entry 16 entry 17 entry 18 entry 19 Counting records You can count the number of rows in0 码力 | 53 页 | 347.03 KB | 1 年前3
peewee Documentation
Release 2.0.22010-01-01 00:00:00 2011-06-07 14:08:48 2011-06-07 14:12:57 >>> for t in Tweet.select().order_by(Tweet.created_date.desc()): ... print t.pub_date ... 2011-06-07 14:12:57 2011-06-07 14:08:48 2010-01-01 00:00:00 order_by(Tweet.id).paginate(2, 10): ... print tweet.message ... tweet 10 tweet 11 tweet 12 tweet 13 tweet 14 tweet 15 tweet 16 tweet 17 tweet 18 tweet 19 Counting records You can count the number of rows in stats_query = Stat.select().naive() # note we are calling "naive()" stats_qr = stats_query.execute() 14 Chapter 1. Contents: peewee Documentation, Release 2.0.0 for stat in stats_qr.iterator(): serializer0 码力 | 65 页 | 315.33 KB | 1 年前3
peewee Documentation
Release 1.0.02010-01-01 00:00:00 2011-06-07 14:08:48 2011-06-07 14:12:57 >>> for e in Entry.select().order_by(peewee.desc(’pub_date’)): ... print e.pub_date ... 2011-06-07 14:12:57 2011-06-07 14:08:48 2010-01-01 00:00:00 10 entry 11 10 Chapter 1. Contents: peewee Documentation, Release 1.0.0 entry 12 entry 13 entry 14 entry 15 entry 16 entry 17 entry 18 entry 19 Counting records You can count the number of rows in have support for automatic schema migrations. Peewee does, however, come with a few helper functions: 14 Chapter 1. Contents: peewee Documentation, Release 1.0.0 • Database.add_column_sql() • Database0 码力 | 71 页 | 405.29 KB | 1 年前3
peewee Documentation Release 0.9.72010-01-01 00:00:00 2011-06-07 14:08:48 2011-06-07 14:12:57 >>> for e in Entry.select().order_by(peewee.desc('pub_date')): ... print e.pub_date ... 2011-06-07 14:12:57 2011-06-07 14:08:48 2010-01-01 00:00:00 order_by('id').paginate(2, 10): ... print entry.title ... entry 10 entry 11 entry 12 entry 13 entry 14 entry 15 entry 16 entry 17 entry 18 entry 19 Counting records You can count the number of rows in0 码力 | 78 页 | 143.68 KB | 1 年前3
peewee Documentation
Release 3.5.0which defines # the database we'll be using. class BaseModel(Model): class Meta: database = database 14 Chapter 1. Contents: peewee Documentation, Release 3.5.0 When developing a web application, it’s 2010-01-01 00:00:00 2011-06-07 14:08:48 2011-06-07 14:12:57 >>> for t in Tweet.select().order_by(Tweet.created_date.desc()): ... print(t.pub_date) ... 2011-06-07 14:12:57 2011-06-07 14:08:48 2010-01-01 00:00:00 order_by(Tweet.id).paginate(2, 10): ... print(tweet.message) ... tweet 10 tweet 11 tweet 12 tweet 13 tweet 14 tweet 15 tweet 16 tweet 17 tweet 18 tweet 19 If you would like more granular control, you can always0 码力 | 282 页 | 1.02 MB | 1 年前3
peewee Documentation
Release 3.3.0a connection pool, connections will only be recycled correctly if you call connect() and close(). 14 Chapter 1. Contents: peewee Documentation, Release 3.3.0 We will tell flask that during the request/response distinct()) Produce a list of costly bookings How can you produce a list of bookings on the day of 2012-09-14 which will cost the member (or guest) more than $30? Remember that guests have different costs to members INNER JOIN facilities AS f ON (b.facid = f.facid) WHERE (date_trunc('day', b.starttime) = '2012-09-14') AND ((m.memid = 0 AND b.slots * f.guestcost > 30) OR (m.memid > 0 AND b.slots * f.membercost >0 码力 | 280 页 | 1.02 MB | 1 年前3
peewee Documentation
Release 3.4.0a connection pool, connections will only be recycled correctly if you call connect() and close(). 14 Chapter 1. Contents: peewee Documentation, Release 3.4.0 We will tell flask that during the request/response distinct()) Produce a list of costly bookings How can you produce a list of bookings on the day of 2012-09-14 which will cost the member (or guest) more than $30? Remember that guests have different costs to members INNER JOIN facilities AS f ON (b.facid = f.facid) WHERE (date_trunc('day', b.starttime) = '2012-09-14') AND ((m.memid = 0 AND b.slots * f.guestcost > 30) OR (m.memid > 0 AND b.slots * f.membercost >0 码力 | 284 页 | 1.03 MB | 1 年前3
peewee Documentation Release 1.0.02010-01-01 00:00:00 2011-06-07 14:08:48 2011-06-07 14:12:57 >>> for e in Entry.select().order_by(peewee.desc('pub_date')): ... print e.pub_date ... 2011-06-07 14:12:57 2011-06-07 14:08:48 2010-01-01 00:00:00 order_by('id').paginate(2, 10): ... print entry.title ... entry 10 entry 11 entry 12 entry 13 entry 14 entry 15 entry 16 entry 17 entry 18 entry 19 Counting records You can count the number of rows in0 码力 | 101 页 | 163.20 KB | 1 年前3
peewee Documentation Release 3.0.0distinct()) Produce a list of costly bookings How can you produce a list of bookings on the day of 2012-09-14 which will cost the member (or guest) more than $30? Remember that guests have different costs to members INNER JOIN facilities AS f ON (b.facid = f.facid) WHERE (date_trunc('day', b.starttime) = '2012-09-14') AND ((m.memid = 0 AND b.slots * f.guestcost > 30) OR (m.memid > 0 AND b.slots * f.membercost > join(Facility) .where( (fn.date_trunc('day', Booking.starttime) == datetime.date(2012, 9, 14)) & (cost > 30)) .order_by(SQL('cost').desc())) # To iterate over the results0 码力 | 319 页 | 361.50 KB | 1 年前3
peewee Documentation
Release 3.6.0database.connect() @app.after_request def after_request(response): database.close() return response 14 Chapter 1. Contents: peewee Documentation, Release 3.6.0 Note: Peewee uses thread local storage to 2010-01-01 00:00:00 2011-06-07 14:08:48 2011-06-07 14:12:57 >>> for t in Tweet.select().order_by(Tweet.created_date.desc()): ... print(t.pub_date) ... 2011-06-07 14:12:57 2011-06-07 14:08:48 2010-01-01 00:00:00 page) 1.7. Querying 73 peewee Documentation, Release 3.6.0 (continued from previous page) tweet 14 tweet 15 tweet 16 tweet 17 tweet 18 tweet 19 If you would like more granular control, you can always0 码力 | 302 页 | 1.02 MB | 1 年前3
共 16 条
- 1
- 2













