peewee Documentation Release 3.6.0
Let’s make sure these are sorted alphabetically by adding an order_by() clause: for pet in Pet.select().where(Pet.owner == uncle_bob).order_by(Pet.name): print(pet.name) # prints: # Fido # Kitty Kitty Let’s list all the people now, youngest to oldest: for person in Person.select().order_by(Person.birthday.desc()): print(person.name, person.birthday) # prints: # Bob 1960-01-15 # Herb 1950-05-05 .join(Pet, JOIN.LEFT_OUTER) # include people without pets. .group_by(Person) .order_by(Person.name)) for person in query: # "pet_count" becomes an attribute on the returned model0 码力 | 377 页 | 399.12 KB | 1 年前3peewee Documentation Release 3.6.0
Let’s make sure these are sorted alphabetically by adding an order_by() clause: for pet in Pet.select().where(Pet.owner == uncle_bob).order_by(Pet.name): print(pet.name) # prints: # Fido # Kitty Let’s Let’s list all the people now, youngest to oldest: for person in Person.select().order_by(Person.birthday.desc()): print(person.name, person.birthday) # prints: # Bob 1960-01-15 # Herb 1950-05-05 # Grandma 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 attribute on the returned model instances0 码力 | 302 页 | 1.02 MB | 1 年前3peewee Documentation Release 3.0.0
Let’s make sure these are sorted alphabetically by adding an order_by() clause: for pet in Pet.select().where(Pet.owner == uncle_bob).order_by(Pet.name): print pet.name # prints: # Fido # Kitty Let’s list all the people now, youngest to oldest: for person in Person.select().order_by(Person.birthday.desc()): print person.name, person.birthday # prints: # Bob 1960-01-15 # Herb 1950-05-05 .join(Pet, JOIN.LEFT_OUTER) # include people without pets. .group_by(Person) .order_by(Person.name)) for person in query: # "pet_count" becomes an attribute on the returned model0 码力 | 319 页 | 361.50 KB | 1 年前3peewee Documentation Release 3.5.0
Let’s make sure these are sorted alphabetically by adding an order_by() clause: for pet in Pet.select().where(Pet.owner == uncle_bob).order_by(Pet.name): print(pet.name) # prints: # Fido # Kitty Kitty Let’s list all the people now, youngest to oldest: for person in Person.select().order_by(Person.birthday.desc()): print(person.name, person.birthday) # prints: # Bob 1960-01-15 # Herb 1950-05-05 .join(Pet, JOIN.LEFT_OUTER) # include people without pets. .group_by(Person) .order_by(Person.name)) for person in query: # "pet_count" becomes an attribute on the returned model0 码力 | 347 页 | 380.80 KB | 1 年前3peewee Documentation Release 3.5.0
Let’s make sure these are sorted alphabetically by adding an order_by() clause: for pet in Pet.select().where(Pet.owner == uncle_bob).order_by(Pet.name): print(pet.name) # prints: # Fido # Kitty Let’s Let’s list all the people now, youngest to oldest: for person in Person.select().order_by(Person.birthday.desc()): print(person.name, person.birthday) # prints: # Bob 1960-01-15 # Herb 1950-05-05 # Grandma 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 attribute on the returned model instances0 码力 | 282 页 | 1.02 MB | 1 年前3peewee Documentation Release 3.4.0
Let’s make sure these are sorted alphabetically by adding an order_by() clause: for pet in Pet.select().where(Pet.owner == uncle_bob).order_by(Pet.name): print(pet.name) # prints: # Fido # Kitty Kitty Let’s list all the people now, youngest to oldest: for person in Person.select().order_by(Person.birthday.desc()): print(person.name, person.birthday) # prints: # Bob 1960-01-15 # Herb 1950-05-05 .join(Pet, JOIN.LEFT_OUTER) # include people without pets. .group_by(Person) .order_by(Person.name)) for person in query: # "pet_count" becomes an attribute on the returned model0 码力 | 349 页 | 382.34 KB | 1 年前3peewee Documentation Release 3.3.0
Let’s make sure these are sorted alphabetically by adding an order_by() clause: for pet in Pet.select().where(Pet.owner == uncle_bob).order_by(Pet.name): print(pet.name) # prints: # Fido # Kitty Let’s Let’s list all the people now, youngest to oldest: for person in Person.select().order_by(Person.birthday.desc()): print(person.name, person.birthday) # prints: # Bob 1960-01-15 # Herb 1950-05-05 # Grandma 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 attribute on the returned model instances0 码力 | 280 页 | 1.02 MB | 1 年前3peewee Documentation Release 3.4.0
Let’s make sure these are sorted alphabetically by adding an order_by() clause: for pet in Pet.select().where(Pet.owner == uncle_bob).order_by(Pet.name): print(pet.name) # prints: # Fido # Kitty Let’s Let’s list all the people now, youngest to oldest: for person in Person.select().order_by(Person.birthday.desc()): print(person.name, person.birthday) # prints: # Bob 1960-01-15 # Herb 1950-05-05 # Grandma 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 attribute on the returned model instances0 码力 | 284 页 | 1.03 MB | 1 年前3peewee Documentation Release 3.1.0
Let’s make sure these are sorted alphabetically by adding an order_by() clause: for pet in Pet.select().where(Pet.owner == uncle_bob).order_by(Pet.name): print(pet.name) # prints: # Fido # Kitty Kitty Let’s list all the people now, youngest to oldest: for person in Person.select().order_by(Person.birthday.desc()): print(person.name, person.birthday) # prints: # Bob 1960-01-15 # Herb 1950-05-05 .join(Pet, JOIN.LEFT_OUTER) # include people without pets. .group_by(Person) .order_by(Person.name)) for person in query: # "pet_count" becomes an attribute on the returned model0 码力 | 332 页 | 370.77 KB | 1 年前3peewee Documentation Release 2.10.2
Let’s make sure these are sorted alphabetically by adding an order_by() clause: >>> for pet in Pet.select().where(Pet.owner == uncle_bob).order_by(Pet.name): ... print pet.name ... Fido Kitty Let’s Let’s list all the people now, youngest to oldest: >>> for person in Person.select().order_by(Person.birthday.desc()): ... print person.name, person.birthday ... Bob 1960-01-15 Herb 1950-05-05 Grandma select(Person, Pet, subquery.alias('pet_count')) ... .join(Pet, JOIN.LEFT_OUTER) ... .order_by(Person.name)) >>> for person in query.aggregate_rows(): # Note the `aggregate_rows()` call.0 码力 | 275 页 | 276.96 KB | 1 年前3
共 447 条
- 1
- 2
- 3
- 4
- 5
- 6
- 45