peewee Documentation
Release 3.5.0Example app . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.4 Contributing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . flask already, you will need to install it to run the example: pip install flask 1.3. Example app 11 peewee Documentation, Release 3.5.0 1.3.1 Running the example After ensuring that flask is installed = BigBitField() bitmap = Bitmap() # Sets the ith bit, e.g. the 1st bit, the 11th bit, the 63rd, etc. bits_to_set = (1, 11, 63, 31, 55, 48, 100, 99) for bit_idx in bits_to_set: bitmap.data.set_bit(bit_idx)0 码力 | 282 页 | 1.02 MB | 1 年前3
peewee Documentation
Release 3.3.0Example app . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.4 Contributing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . flask already, you will need to install it to run the example: pip install flask 1.3. Example app 11 peewee Documentation, Release 3.3.0 1.3.1 Running the example After ensuring that flask is installed = BigBitField() bitmap = Bitmap() # Sets the ith bit, e.g. the 1st bit, the 11th bit, the 63rd, etc. bits_to_set = (1, 11, 63, 31, 55, 48, 100, 99) for bit_idx in bits_to_set: (continues on next page)0 码力 | 280 页 | 1.02 MB | 1 年前3
peewee Documentation
Release 3.4.0Example app . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.4 Contributing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . flask already, you will need to install it to run the example: pip install flask 1.3. Example app 11 peewee Documentation, Release 3.4.0 1.3.1 Running the example After ensuring that flask is installed 0 (continued from previous page) # Sets the ith bit, e.g. the 1st bit, the 11th bit, the 63rd, etc. bits_to_set = (1, 11, 63, 31, 55, 48, 100, 99) for bit_idx in bits_to_set: bitmap.data.set_bit(bit_idx)0 码力 | 284 页 | 1.03 MB | 1 年前3
peewee Documentation
Release 3.5.0= BigBitField() bitmap = Bitmap() # Sets the ith bit, e.g. the 1st bit, the 11th bit, the 63rd, etc. bits_to_set = (1, 11, 63, 31, 55, 48, 100, 99) for bit_idx in bits_to_set: bitmap.data.set_bit(bit_idx) using "is_set": assert bitmap.data.is_set(11) assert not bitmap.data.is_set(12) # We can clear a bit: bitmap.data.clear_bit(11) assert not bitmap.data.is_set(11) # We can also "toggle" a bit. Recall that Tweet.select().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 granular0 码力 | 347 页 | 380.80 KB | 1 年前3
peewee Documentation Release 3.4.0= BigBitField() bitmap = Bitmap() # Sets the ith bit, e.g. the 1st bit, the 11th bit, the 63rd, etc. bits_to_set = (1, 11, 63, 31, 55, 48, 100, 99) for bit_idx in bits_to_set: bitmap.data.set_bit(bit_idx) using "is_set": assert bitmap.data.is_set(11) assert not bitmap.data.is_set(12) # We can clear a bit: bitmap.data.clear_bit(11) assert not bitmap.data.is_set(11) # We can also "toggle" a bit. Recall that Tweet.select().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 granular0 码力 | 349 页 | 382.34 KB | 1 年前3
peewee Documentation Release 3.1.0= BigBitField() bitmap = Bitmap() # Sets the ith bit, e.g. the 1st bit, the 11th bit, the 63rd, etc. bits_to_set = (1, 11, 63, 31, 55, 48, 100, 99) for bit_idx in bits_to_set: bitmap.data.set_bit(bit_idx) using "is_set": assert bitmap.data.is_set(11) assert not bitmap.data.is_set(12) # We can clear a bit: bitmap.data.clear_bit(11) assert not bitmap.data.is_set(11) # We can also "toggle" a bit. Recall that Tweet.select().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 granular0 码力 | 332 页 | 370.77 KB | 1 年前3
peewee Documentation
Release 3.6.0Example app . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.4 Contributing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . installed, cd into the twitter example directory and execute the run_example.py script: 1.3. Example app 11 peewee Documentation, Release 3.6.0 python run_example.py The example app will be accessible at = BigBitField() bitmap = Bitmap() # Sets the ith bit, e.g. the 1st bit, the 11th bit, the 63rd, etc. bits_to_set = (1, 11, 63, 31, 55, 48, 100, 99) for bit_idx in bits_to_set: bitmap.data.set_bit(bit_idx)0 码力 | 302 页 | 1.02 MB | 1 年前3
peewee Documentation Release 3.6.0= BigBitField() bitmap = Bitmap() # Sets the ith bit, e.g. the 1st bit, the 11th bit, the 63rd, etc. bits_to_set = (1, 11, 63, 31, 55, 48, 100, 99) for bit_idx in bits_to_set: bitmap.data.set_bit(bit_idx) using "is_set": assert bitmap.data.is_set(11) assert not bitmap.data.is_set(12) # We can clear a bit: bitmap.data.clear_bit(11) assert not bitmap.data.is_set(11) # We can also "toggle" a bit. Recall that Tweet.select().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 granular0 码力 | 377 页 | 399.12 KB | 1 年前3
peewee Documentation Release 3.0.0Tweet.select().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 -- Returns rows like -- "Meow I'm a tweet" | 2017-01-17 13:37:00 | huey -- "Woof woof" | 2017-01-17 11:59:00 | mickey -- "Purr" | 2017-01-17 10:00:00 | huey With Peewee we would write this query: query = BigBitField() bitmap = Bitmap() # Sets the ith bit, e.g. the 1st bit, the 11th bit, the 63rd, etc. bits_to_set = (1, 11, 63, 31, 55, 48, 100, 99) for bit_idx in bits_to_set: bitmap.data.set_bit(bit_idx)0 码力 | 319 页 | 361.50 KB | 1 年前3
peewee Documentation
Release 0.9.7for entry in Entry.select().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 ON t1."id" = t2."tag_id" INNER JOIN "photo" AS t3 ON t2."photo_id" = t3."id" 1.3. Peewee Cookbook 11 peewee Documentation, Release 0.9.7 GROUP BY t1."id", t1."name" HAVING count(*) > 5 Suppose we posted on %s’ % (entry.title, entry.blog.title) Looking at the query log, though, this will cause 11 queries: • 1 query for the entries • 1 query for every related blog (10 total) This can be optimized0 码力 | 53 页 | 347.03 KB | 1 年前3
共 16 条
- 1
- 2













