peewee Documentation Release 0.9.7
query, a DoesNotExist exception will be raised. >>> Blog.get(id=1) <__main__.Blog object at 0x25294d0> >>> Blog.get(id=1).name u'My Blog' >>> Blog.get(creator='Chuck') <__main__.Blog object at 0x2529410> ry:', autocommit=False) Blog.create(name='foo blog') db.commit() Introspecting databases If you’d like to generate some models for an existing database, you can try out the database introspection tool > 0 def gravatar_url(self, size=80): return 'http://www.gravatar.com/avatar/%s? d=identicon&s=%d' % \ (md5(self.email.strip().lower().encode('utf- 8')).hexdigest(), size) class0 码力 | 78 页 | 143.68 KB | 1 年前3peewee Documentation Release 1.0.0
query, a DoesNotExist exception will be raised. >>> Blog.get(id=1) <__main__.Blog object at 0x25294d0> >>> Blog.get(id=1).name u'My Blog' >>> Blog.get(creator='Chuck') <__main__.Blog object at 0x2529410> ry:', autocommit=False) Blog.create(name='foo blog') db.commit() Introspecting databases If you’d like to generate some models for an existing database, you can try out the database introspection tool > 0 def gravatar_url(self, size=80): return 'http://www.gravatar.com/avatar/%s? d=identicon&s=%d' % \ (md5(self.email.strip().lower().encode('utf- 8')).hexdigest(), size) class0 码力 | 101 页 | 163.20 KB | 1 年前3peewee Documentation Release 0.9.7
query, a DoesNotExist exception will be raised. >>> Blog.get(id=1) <__main__.Blog object at 0x25294d0> >>> Blog.get(id=1).name u’My Blog’ >>> Blog.get(creator=’Chuck’) <__main__.Blog object at 0x2529410> autocommit=False) Blog.create(name=’foo blog’) db.commit() 1.3.4 Introspecting databases If you’d like to generate some models for an existing database, you can try out the database introspection tool to_user=user ).count() > 0 def gravatar_url(self, size=80): return ’http://www.gravatar.com/avatar/%s?d=identicon&s=%d’ % \ (md5(self.email.strip().lower().encode(’utf-8’)).hexdigest(), size) class Relationship(BaseModel):0 码力 | 53 页 | 347.03 KB | 1 年前3peewee Documentation Release 1.0.0
query, a DoesNotExist exception will be raised. >>> Blog.get(id=1) <__main__.Blog object at 0x25294d0> >>> Blog.get(id=1).name u’My Blog’ >>> Blog.get(creator=’Chuck’) <__main__.Blog object at 0x2529410> autocommit=False) Blog.create(name=’foo blog’) db.commit() 1.3.4 Introspecting databases If you’d like to generate some models for an existing database, you can try out the database introspection tool to_user=user ).count() > 0 def gravatar_url(self, size=80): return ’http://www.gravatar.com/avatar/%s?d=identicon&s=%d’ % \ (md5(self.email.strip().lower().encode(’utf-8’)).hexdigest(), size) class Relationship(BaseModel):0 码力 | 71 页 | 405.29 KB | 1 年前3peewee Documentation Release 2.10.2
primary features. This guide will cover: Model Definition Storing data Retrieving Data Note If you’d like something a bit more meaty, there is a thorough tutorial on creating a “twitter”-style web app after 1959 (bob) >>> d1940 = date(1940, 1, 1) >>> d1960 = date(1960, 1, 1) >>> query = (Person ... .select() ... .where((Person.birthday < d1940) | (Person.birthday > d1960))) ... >>> for 1960: >>> query = (Person ... .select() ... .where((Person.birthday > d1940) & (Person.birthday < d1960))) ... >>> for person in query: ... print person.name, person.birthday ... Herb0 码力 | 275 页 | 276.96 KB | 1 年前3peewee Documentation Release 2.10.2
1. Contents: peewee Documentation, Release 2.10.2 • Storing data • Retrieving Data Note: If you’d like something a bit more meaty, there is a thorough tutorial on creating a “twitter”-style web app (grandma) • after 1959 (bob) >>> d1940 = date(1940, 1, 1) >>> d1960 = date(1960, 1, 1) >>> query = (Person ... .select() ... .where((Person.birthday < d1940) | (Person.birthday > d1960))) ... >>> for person between 1940 and 1960: >>> query = (Person ... .select() ... .where((Person.birthday > d1940) & (Person.birthday < d1960))) ... >>> for person in query: ... print person.name, person.birthday ... Herb0 码力 | 221 页 | 844.06 KB | 1 年前3peewee Documentation Release 2.0.2
DoesNotExist exception will be raised. >>> User.get(User.id == 1) <__main__.Blog object at 0x25294d0> >>> User.get(User.id == 1).username u’Charlie’ >>> User.get(User.username == ’Charlie’) <__main__ >>> u.id 999 >>> User.get(User.username == ’somebody’).id 999 1.4.5 Introspecting databases If you’d like to generate some models for an existing database, you can try out the database introspection tool user) ).count() > 0 def gravatar_url(self, size=80): return ’http://www.gravatar.com/avatar/%s?d=identicon&s=%d’ % \ (md5(self.email.strip().lower().encode(’utf-8’)).hexdigest(), size) # this model contains0 码力 | 65 页 | 315.33 KB | 1 年前3peewee Documentation Release 3.5.0
primary features. This guide will cover: Model Definition Storing data Retrieving Data Note If you’d like something a bit more meaty, there is a thorough tutorial on creating a “twitter”-style web app (grandma) after 1959 (bob) d1940 = date(1940, 1, 1) d1960 = date(1960, 1, 1) query = (Person .select() .where((Person.birthday < d1940) | (Person.birthday > d1960))) for person in query: between 1940 and 1960: query = (Person .select() .where(Person.birthday.between(d1940, d1960))) for person in query: print(person.name, person.birthday) # prints: # Herb 1950-05-050 码力 | 347 页 | 380.80 KB | 1 年前3peewee Documentation Release 3.4.0
primary features. This guide will cover: Model Definition Storing data Retrieving Data Note If you’d like something a bit more meaty, there is a thorough tutorial on creating a “twitter”-style web app (grandma) after 1959 (bob) d1940 = date(1940, 1, 1) d1960 = date(1960, 1, 1) query = (Person .select() .where((Person.birthday < d1940) | (Person.birthday > d1960))) for person in query: between 1940 and 1960: query = (Person .select() .where(Person.birthday.between(d1940, d1960))) for person in query: print(person.name, person.birthday) # prints: # Herb 1950-05-050 码力 | 349 页 | 382.34 KB | 1 年前3peewee Documentation Release 3.0.0
primary features. This guide will cover: Model Definition Storing data Retrieving Data Note If you’d like something a bit more meaty, there is a thorough tutorial on creating a “twitter”-style web app (grandma) after 1959 (bob) d1940 = date(1940, 1, 1) d1960 = date(1960, 1, 1) query = (Person .select() .where((Person.birthday < d1940) | (Person.birthday > d1960))) for person in query: between 1940 and 1960: query = (Person .select() .where(Person.birthday.between(d1940, d1960))) for person in query: print person.name, person.birthday # prints: # Herb 1950-05-050 码力 | 319 页 | 361.50 KB | 1 年前3
共 16 条
- 1
- 2