peewee Documentation Release 0.9.7
let’s say we want to find students who are enrolled in math class: for student in Student.select().join(StudentCourse).join(Course).where( name='math'): print student.name You could also express this this as: for student in Student.filter(studentcourse_set__course__name='math'): print student.name To query what classes a given student is enrolled in: for course in Course.select().join(StudentCourse)0 码力 | 78 页 | 143.68 KB | 1 年前3peewee Documentation Release 0.9.7
let’s say we want to find students who are enrolled in math class: for student in Student.select().join(StudentCourse).join(Course).where(name=’math’): print student.name You could also express this as: as: for student in Student.filter(studentcourse_set__course__name=’math’): print student.name To query what classes a given student is enrolled in: for course in Course.select().join(StudentCourse)0 码力 | 53 页 | 347.03 KB | 1 年前3peewee Documentation Release 2.0.2
say we want to find students who are enrolled in math class: for student in Student.select().join(StudentCourse).join(Course).where(Course.name == ’math’): print student.name To query what classes a functions can be used to calculate counts and sums over rows, perform string manipulations, do complex math, and more. There are a lot of functions. To express functions in peewee, use the fn object. The way0 码力 | 65 页 | 315.33 KB | 1 年前3peewee Documentation Release 1.0.0
let’s say we want to find students who are enrolled in math class: for student in Student.select().join(StudentCourse).join(Course).where( name='math'): print student.name You could also express this this as: for student in Student.filter(studentcourse_set__course__name='math'): print student.name To query what classes a given student is enrolled in: for course in Course.select().join(StudentCourse)0 码力 | 101 页 | 163.20 KB | 1 年前3peewee Documentation Release 1.0.0
let’s say we want to find students who are enrolled in math class: for student in Student.select().join(StudentCourse).join(Course).where(name=’math’): print student.name You could also express this as: as: for student in Student.filter(studentcourse_set__course__name=’math’): print student.name To query what classes a given student is enrolled in: for course in Course.select().join(StudentCourse)0 码力 | 71 页 | 405.29 KB | 1 年前3peewee Documentation Release 3.0.0
find students who are enrolled in math class: query = (Student .select() .join(StudentCourse) .join(Course) .where(Course.name == 'math')) for student in query: print(student can register individual groups. This will just # register the DATE and MATH groups of functions. register_groups(db, 'DATE', 'MATH') # If you only wish to register, say, the aggregate functions for a # the toggle() function. clear_settings() Clears all state associated with the setting() function. MATH randomrange(start[, stop=None[, step=None]]) start (int) – Start of range (inclusive) end (int)0 码力 | 319 页 | 361.50 KB | 1 年前3peewee Documentation Release 3.5.0
find students who are enrolled in math class: query = (Student .select() .join(StudentCourse) .join(Course) .where(Course.name == 'math')) for student in query: print(student can register individual groups. This will just # register the DATE and MATH groups of functions. register_groups(db, 'DATE', 'MATH') # If you only wish to register, say, the aggregate functions for a # the toggle() function. clear_settings() Clears all state associated with the setting() function. MATH randomrange(start[, stop=None[, step=None]]) start (int) – Start of range (inclusive) end (int)0 码力 | 347 页 | 380.80 KB | 1 年前3peewee Documentation Release 3.4.0
find students who are enrolled in math class: query = (Student .select() .join(StudentCourse) .join(Course) .where(Course.name == 'math')) for student in query: print(student can register individual groups. This will just # register the DATE and MATH groups of functions. register_groups(db, 'DATE', 'MATH') # If you only wish to register, say, the aggregate functions for a # the toggle() function. clear_settings() Clears all state associated with the setting() function. MATH randomrange(start[, stop=None[, step=None]]) start (int) – Start of range (inclusive) end (int)0 码力 | 349 页 | 382.34 KB | 1 年前3peewee Documentation Release 3.1.0
find students who are enrolled in math class: query = (Student .select() .join(StudentCourse) .join(Course) .where(Course.name == 'math')) for student in query: print(student can register individual groups. This will just # register the DATE and MATH groups of functions. register_groups(db, 'DATE', 'MATH') # If you only wish to register, say, the aggregate functions for a # the toggle() function. clear_settings() Clears all state associated with the setting() function. MATH randomrange(start[, stop=None[, step=None]]) start (int) – Start of range (inclusive) end (int)0 码力 | 332 页 | 370.77 KB | 1 年前3peewee Documentation Release 3.5.0
course = ForeignKeyField(Course) To query, let’s say we want to find students who are enrolled in math class: query = (Student .select() .join(StudentCourse) (continues on next page) 78 Chapter 1. Contents: Documentation, Release 3.5.0 (continued from previous page) .join(Course) .where(Course.name == 'math')) for student in query: print(student.name) To query what classes a given student is enrolled can register individual groups. This will just # register the DATE and MATH groups of functions. register_groups(db, 'DATE', 'MATH') # If you only wish to register, say, the aggregate functions for a #0 码力 | 282 页 | 1.02 MB | 1 年前3
共 16 条
- 1
- 2