peewee Documentation Release 0.9.7old. >>> delete_query = Entry.delete().where(pub_date__lt=one_year_ago) >>> delete_query.execute() 7 # <--- number of entries deleted For more information, see the documentation on DeleteQuery. Selecting >>> user_q = User.select() # <-- query is not executed >>> user_q7f6b0810c610> >>> [u.username for u in user_q] # <-- query is evaluated here [u'admin', u'staff', u'editor'] see the discussion here [https://groups.google.com/forum/?fromgroups#!topic/peewee- orm/RLd2r-eKp7w]. Speeding up simple select queries Simple select queries can get a performance boost (especially 0 码力 | 78 页 | 143.68 KB | 1 年前3
peewee Documentation
Release 0.9.7ne_year_ago) >>> delete_query.execute() 7 # <--- number of entries deleted For more information, see the documentation on DeleteQuery. 1.3. Peewee Cookbook 7 peewee Documentation, Release 0.9.7 Selecting >>> user_q = User.select() # <-- query is not executed >>> user_q7f6b0810c610> >>> [u.username for u in user_q] # <-- query is evaluated here [u’admin’, u’staff’, u’editor’] User.delete().where(active=False) # <-- returns a DeleteQuery >>> dq 7fc866ada4d0> >>> dq.execute() # <-- executes the query and returns number of rows deleted 3 >>> uq = 0 码力 | 53 页 | 347.03 KB | 1 年前3
peewee Documentation
Release 2.0.2which were created in the last week. last_week = datetime.datetime.now() - datetime.timedelta(days=7) # 1.0 Tweet.select().where(created_date__gt=last_week).join(User).where( Q(username=’charlie’) | Q(username=’peewee database-related tasks with peewee. Examples will use the following models: 1.4. Peewee Cookbook 7 peewee Documentation, Release 2.0.0 from peewee import * class User(Model): username = CharField() >>> delete_query = Tweet.delete().where(Tweet.pub_date < one_year_ago) >>> delete_query.execute() 7 # <--- number of rows deleted For more information, see the documentation on DeleteQuery. Selecting0 码力 | 65 页 | 315.33 KB | 1 年前3
peewee Documentation Release 3.4.0exists, otherwise it will open a new connection. >>> db.connection()7f94e9362f10> Connection Pooling Connection pooling is provided by the pool module, included in the AttributeError: type object 'Person' has no attribute 'Meta' >>> Person._meta 7f51a2f03790> The ModelOptions class implements several methods which may be of use for retrieving model 7f51a2e92750>, 'name': 7f51a2f0a510>} >>> Person._meta.primary_key 7f51a2e92750> >>> Person._meta.database 0 码力 | 349 页 | 382.34 KB | 1 年前3
peewee Documentation
Release 3.4.0join(Person) .where(Pet.animal_type == 'cat')) for pet in query: (continues on next page) 1.2. Quickstart 7 peewee Documentation, Release 3.4.0 (continued from previous page) print(pet.name, pet.owner.name) exists, otherwise it will open a new connection. >>> db.connection()7f94e9362f10> 1.6.9 Connection Pooling Connection pooling is provided by the pool module, included in AttributeError: type object 'Person' has no attribute 'Meta' >>> Person._meta 7f51a2f03790> The ModelOptions class implements several methods which may be of use for retrieving model 0 码力 | 284 页 | 1.03 MB | 1 年前3
peewee Documentation
Release 3.5.0exists, otherwise it will open a new connection. >>> db.connection()7f94e9362f10> Connection Pooling Connection pooling is provided by the pool module, included in the AttributeError: type object 'Person' has no attribute 'Meta' >>> Person._meta 7f51a2f03790> The ModelOptions class implements several methods which may be of use for retrieving model 7f51a2e92750>, 'name': 7f51a2f0a510>} >>> Person._meta.primary_key 7f51a2e92750> >>> Person._meta.database 0 码力 | 347 页 | 380.80 KB | 1 年前3
peewee Documentation
Release 3.5.0join(Person) .where(Pet.animal_type == 'cat')) for pet in query: (continues on next page) 1.2. Quickstart 7 peewee Documentation, Release 3.5.0 (continued from previous page) print(pet.name, pet.owner.name) exists, otherwise it will open a new connection. >>> db.connection()7f94e9362f10> 1.5.9 Connection Pooling Connection pooling is provided by the pool module, included in AttributeError: type object 'Person' has no attribute 'Meta' >>> Person._meta 7f51a2f03790> The ModelOptions class implements several methods which may be of use for retrieving model 0 码力 | 282 页 | 1.02 MB | 1 年前3
peewee Documentation
Release 3.3.0join(Person) .where(Pet.animal_type == 'cat')) for pet in query: (continues on next page) 1.2. Quickstart 7 peewee Documentation, Release 3.3.0 (continued from previous page) print(pet.name, pet.owner.name) exists, otherwise it will open a new connection. >>> db.connection()7f94e9362f10> 1.6.9 Connection Pooling Connection pooling is provided by the pool module, included in AttributeError: type object 'Person' has no attribute 'Meta' >>> Person._meta 7f51a2f03790> The ModelOptions class implements several methods which may be of use for retrieving model 0 码力 | 280 页 | 1.02 MB | 1 年前3
peewee Documentation Release 3.6.0exists, otherwise it will open a new connection. >>> db.connection()7f94e9362f10> Connection Pooling Connection pooling is provided by the pool module, included in the AttributeError: type object 'Person' has no attribute 'Meta' >>> Person._meta 7f51a2f03790> The ModelOptions class implements several methods which may be of use for retrieving model 7f51a2e92750>, 'name': 7f51a2f0a510>} >>> Person._meta.primary_key 7f51a2e92750> >>> Person._meta.database 0 码力 | 377 页 | 399.12 KB | 1 年前3
peewee Documentation
Release 3.6.0join. query = (Pet .select(Pet, Person) .join(Person) (continues on next page) 1.2. Quickstart 7 peewee Documentation, Release 3.6.0 (continued from previous page) .where(Pet.animal_type == 'cat')) exists, otherwise it will open a new connection. >>> db.connection()7f94e9362f10> 1.5.9 Connection Pooling Connection pooling is provided by the pool module, included in AttributeError: type object 'Person' has no attribute 'Meta' >>> Person._meta 7f51a2f03790> The ModelOptions class implements several methods which may be of use for retrieving model 0 码力 | 302 页 | 1.02 MB | 1 年前3
共 16 条
- 1
- 2













