peewee Documentation Release 2.10.2executed. Finally, let’s do a complicated one. Let’s get all the people whose birthday was either: before 1940 (grandma) after 1959 (bob) >>> d1940 = date(1940, 1, 1) >>> d1960 = date(1960, 1, 1) >>> query database.create_tables([User, ...], True) and peewee will first check to see if the table exists before creating it. Establishing a database connection You may have noticed in the above model code that connection to the database. Flask provides some handy decorators to make this a snap: @app.before_request def before_request(): database.connect() @app.after_request def after_request(response): database0 码力 | 275 页 | 276.96 KB | 1 年前3
peewee Documentation
Release 2.10.2executed. Finally, let’s do a complicated one. Let’s get all the people whose birthday was either: • before 1940 (grandma) • after 1959 (bob) >>> d1940 = date(1940, 1, 1) >>> d1960 = date(1960, 1, 1) >>> database.create_tables([User, ...], True) and peewee will first check to see if the table exists before creating it. Establishing a database connection You may have noticed in the above model code that connection to the database. Flask provides some handy decorators to make this a snap: @app.before_request def before_request(): database.connect() @app.after_request def after_request(response): database0 码力 | 221 页 | 844.06 KB | 1 年前3
peewee Documentation Release 3.0.0Peewee supports arbitrarily-nested expressions. Let’s get all the people whose birthday was either: before 1940 (grandma) after 1959 (bob) d1940 = date(1940, 1, 1) d1960 = date(1960, 1, 1) query = (Person As you may have guessed, this could easily turn into another N+1 situation if we’re not careful. Before diving into the code, consider how this example is different from the earlier example where we listed connection to the database. Flask provides some handy decorators to make this a snap: @app.before_request def before_request(): database.connect() @app.after_request def after_request(response): database0 码力 | 319 页 | 361.50 KB | 1 年前3
peewee Documentation Release 3.4.0Peewee supports arbitrarily-nested expressions. Let’s get all the people whose birthday was either: before 1940 (grandma) after 1959 (bob) d1940 = date(1940, 1, 1) d1960 = date(1960, 1, 1) query = (Person As you may have guessed, this could easily turn into another N+1 situation if we’re not careful. Before diving into the code, consider how this example is different from the earlier example where we listed connection to the database. Flask provides some handy decorators to make this a snap: @app.before_request def before_request(): database.connect() @app.after_request def after_request(response): database0 码力 | 349 页 | 382.34 KB | 1 年前3
peewee Documentation Release 3.1.0Peewee supports arbitrarily-nested expressions. Let’s get all the people whose birthday was either: before 1940 (grandma) after 1959 (bob) d1940 = date(1940, 1, 1) d1960 = date(1960, 1, 1) query = (Person As you may have guessed, this could easily turn into another N+1 situation if we’re not careful. Before diving into the code, consider how this example is different from the earlier example where we listed connection to the database. Flask provides some handy decorators to make this a snap: @app.before_request def before_request(): database.connect() @app.after_request def after_request(response): database0 码力 | 332 页 | 370.77 KB | 1 年前3
peewee Documentation
Release 3.3.0Peewee supports arbitrarily-nested expressions. Let’s get all the people whose birthday was either: • before 1940 (grandma) • after 1959 (bob) d1940 = date(1940, 1, 1) d1960 = date(1960, 1, 1) query = (Person another N+1 situation if we’re not careful. 1.2. Quickstart 9 peewee Documentation, Release 3.3.0 Before diving into the code, consider how this example is different from the earlier example where we listed connection to the database. Flask provides some handy decorators to make this a snap: @app.before_request def before_request(): database.connect() @app.after_request def after_request(response): database0 码力 | 280 页 | 1.02 MB | 1 年前3
peewee Documentation
Release 3.4.0Peewee supports arbitrarily-nested expressions. Let’s get all the people whose birthday was either: • before 1940 (grandma) • after 1959 (bob) d1940 = date(1940, 1, 1) d1960 = date(1960, 1, 1) query = (Person another N+1 situation if we’re not careful. 1.2. Quickstart 9 peewee Documentation, Release 3.4.0 Before diving into the code, consider how this example is different from the earlier example where we listed connection to the database. Flask provides some handy decorators to make this a snap: @app.before_request def before_request(): database.connect() @app.after_request def after_request(response): database0 码力 | 284 页 | 1.03 MB | 1 年前3
peewee Documentation
Release 3.5.0Peewee supports arbitrarily-nested expressions. Let’s get all the people whose birthday was either: before 1940 (grandma) after 1959 (bob) d1940 = date(1940, 1, 1) d1960 = date(1960, 1, 1) query = (Person As you may have guessed, this could easily turn into another N+1 situation if we’re not careful. Before diving into the code, consider how this example is different from the earlier example where we listed connection to the database. Flask provides some handy decorators to make this a snap: @app.before_request def before_request(): database.connect() @app.after_request def after_request(response): database0 码力 | 347 页 | 380.80 KB | 1 年前3
peewee Documentation
Release 3.5.0Peewee supports arbitrarily-nested expressions. Let’s get all the people whose birthday was either: • before 1940 (grandma) • after 1959 (bob) d1940 = date(1940, 1, 1) d1960 = date(1960, 1, 1) query = (Person another N+1 situation if we’re not careful. 1.2. Quickstart 9 peewee Documentation, Release 3.5.0 Before diving into the code, consider how this example is different from the earlier example where we listed connection to the database. Flask provides some handy decorators to make this a snap: @app.before_request def before_request(): database.connect() @app.after_request def after_request(response): database0 码力 | 282 页 | 1.02 MB | 1 年前3
peewee Documentation Release 3.6.0Peewee supports arbitrarily-nested expressions. Let’s get all the people whose birthday was either: before 1940 (grandma) after 1959 (bob) d1940 = date(1940, 1, 1) d1960 = date(1960, 1, 1) query = (Person As you may have guessed, this could easily turn into another N+1 situation if we’re not careful. Before diving into the code, consider how this example is different from the earlier example where we listed connection to the database. Flask provides some handy decorators to make this a snap: @app.before_request def before_request(): database.connect() @app.after_request def after_request(response): database0 码力 | 377 页 | 399.12 KB | 1 年前3
共 16 条
- 1
- 2













