peewee Documentation Release 0.9.7another way of expressing the same User.select({ User: ['*'], Tweet: [Count('id', 'count')] }).group_by('id').join(Tweet).order_by(('count', 'desc')) # do an atomic update TweetCount.update(count=F('count') SELECT "id", "creator", "name" FROM "blog" WHERE "id" = ? LIMIT 1 PARAMS: [1] To delete an arbitrary group of records, you can issue a DELETE query. The following will delete all Entry objects that are a year equivalent to the following: query = Blog.select({ Blog: ['*'], Entry: [Count('id')], }).group_by(Blog).join(Entry) The resulting query will return Blog objects with all their normal attributes0 码力 | 78 页 | 143.68 KB | 1 年前3
peewee Documentation
Release 0.9.7# another way of expressing the same User.select({ User: [’*’], Tweet: [Count(’id’, ’count’)] }).group_by(’id’).join(Tweet).order_by((’count’, ’desc’)) # do an atomic update TweetCount.update(count=F(’count’) SELECT "id", "creator", "name" FROM "blog" WHERE "id" = ? LIMIT 1 PARAMS: [1] To delete an arbitrary group of records, you can issue a DELETE query. The following will delete all Entry objects that are a year This is equivalent to the following: query = Blog.select({ Blog: [’*’], Entry: [Count(’id’)], }).group_by(Blog).join(Entry) The resulting query will return Blog objects with all their normal attributes0 码力 | 53 页 | 347.03 KB | 1 年前3
peewee Documentation Release 1.0.0another way of expressing the same User.select({ User: ['*'], Tweet: [Count('id', 'count')] }).group_by('id').join(Tweet).order_by(('count', 'desc')) # do an atomic update TweetCount.update(count=F('count') "id", "creator", "name" FROM "blog" WHERE "id" = ? LIMIT 1 PARAMS: [1] To delete an arbitrary group of records, you can issue a DELETE query. The following will delete all Entry objects that are a year equivalent to the following: query = Blog.select({ Blog: ['*'], Entry: [Count('id')], }).group_by(Blog).join(Entry) The resulting query will return Blog objects with all their normal attributes0 码力 | 101 页 | 163.20 KB | 1 年前3
peewee Documentation
Release 1.0.0# another way of expressing the same User.select({ User: [’*’], Tweet: [Count(’id’, ’count’)] }).group_by(’id’).join(Tweet).order_by((’count’, ’desc’)) # do an atomic update TweetCount.update(count=F(’count’) SELECT "id", "creator", "name" FROM "blog" WHERE "id" = ? LIMIT 1 PARAMS: [1] To delete an arbitrary group of records, you can issue a DELETE query. The following will delete all Entry objects that are a year This is equivalent to the following: query = Blog.select({ Blog: [’*’], Entry: [Count(’id’)], }).group_by(Blog).join(Entry) The resulting query will return Blog objects with all their normal attributes0 码力 | 71 页 | 405.29 KB | 1 年前3
peewee Documentation
Release 2.0.2similar way of expressing the same User.select( User, fn.Count(Tweet.id).alias(’ct’) ).join(Tweet).group_by(User).order_by(R(’ct desc’)) # do an atomic update Counter.update(count=Counter.count + 1).where( ’last_date’)] }).join(Tweet, ’LEFT OUTER’).group_by(User) # 2.0 User.select( User, fn.Max(Tweet.created_date).alias(’last_date’) ).join(Tweet, JOIN_LEFT_OUTER).group_by(User) Let’s do an atomic update on SELECT t1."id", t1."username" FROM "user" AS t1 WHERE t1."id" = ? PARAMS: [1] To delete an arbitrary group of records, you can issue a DELETE query. The following will delete all Tweet objects that are a year0 码力 | 65 页 | 315.33 KB | 1 年前3
peewee Documentation Release 2.10.2Savepoint and ExecutionContext Metadata Types Misc Hacks Optimistic Locking Top object per group Top N objects per group Writing custom functions with SQLite Note If you find any bugs, odd behavior, or have your queries as complex as you like. All the other SQL clauses are available as well, such as: group_by() having() limit() and offset() Check the documentation on Querying for more info. Working with questions, but it may take a bit to get to them. Ask on the mailing list, https://groups.google.com/group/peewee-orm Managing your Database This document describes how to perform typical database-related0 码力 | 275 页 | 276.96 KB | 1 年前3
peewee Documentation
Release 2.10.2your queries as complex as you like. All the other SQL clauses are available as well, such as: • group_by() 1.2. Quickstart 9 peewee Documentation, Release 2.10.2 • having() • limit() and offset() questions, but it may take a bit to get to them. • Ask on the mailing list, https://groups.google.com/group/peewee-orm 1.6 Managing your Database This document describes how to perform typical database-related (User .select(User.username, fn.COUNT(Tweet.id).alias('num_tweets')) .join(Tweet, JOIN.LEFT_OUTER) .group_by(User.username)) You can order using the same COUNT expression used in the select clause. In the0 码力 | 221 页 | 844.06 KB | 1 年前3
peewee Documentation Release 3.0.0Examples Model Definitions Schema Creation Basic Exercises Joins and Subqueries Modifying Data Aggregation Recursion Database Initializing a Database Using Postgresql Using SQLite Using MySQL Connecting queries Update queries Delete queries More Hacks Optimistic Locking Top object per group Top N objects per group Writing custom functions with SQLite Note If you find any bugs, odd behavior, or have alias('pet_count')) .join(Pet, JOIN.LEFT_OUTER) # include people without pets. .group_by(Person) .order_by(Person.name)) for person in query: # "pet_count" becomes an attribute0 码力 | 319 页 | 361.50 KB | 1 年前3
peewee Documentation
Release 3.5.0Modifying Data Aggregation Recursion Query Builder Declaring tables Select queries Insert queries Update queries Delete queries Query Objects More Hacks Optimistic Locking Top object per group Top N objects objects per group Writing custom functions with SQLite Changes in 3.0 Backwards-incompatible New stuff Note If you find any bugs, odd behavior, or have an idea for a new feature please don’t hesitate alias('pet_count')) .join(Pet, JOIN.LEFT_OUTER) # include people without pets. .group_by(Person) .order_by(Person.name)) for person in query: # "pet_count" becomes an attribute0 码力 | 347 页 | 380.80 KB | 1 年前3
peewee Documentation Release 3.4.0Examples Model Definitions Schema Creation Basic Exercises Joins and Subqueries Modifying Data Aggregation Recursion Database Initializing a Database Using Postgresql Using SQLite Using MySQL Connecting Update queries Delete queries Query Objects More Hacks Optimistic Locking Top object per group Top N objects per group Writing custom functions with SQLite Note If you find any bugs, odd behavior, or have alias('pet_count')) .join(Pet, JOIN.LEFT_OUTER) # include people without pets. .group_by(Person) .order_by(Person.name)) for person in query: # "pet_count" becomes an attribute0 码力 | 349 页 | 382.34 KB | 1 年前3
共 16 条
- 1
- 2













