peewee Documentation Release 1.0.0
>>> custom_db = peewee.SqliteDatabase('custom.db') >>> class CustomModel(peewee.Model): ... whatev = peewee.CharField() ... ... class Meta: ... database = custom_db ... >>> custom_db.connect() and then all your models will extend it: custom_db = peewee.SqliteDatabase('custom.db') class CustomModel(peewee.Model): class Meta: database = custom_db class Blog(CustomModel): creator entries: query = Blog.select().join(Entry, 'left outer').annotate(Entry) You can also specify a custom aggregator: query = Blog.select().annotate(Entry, peewee.Max('pub_date', 'max_pub_date')) Let’s0 码力 | 101 页 | 163.20 KB | 1 年前3peewee Documentation Release 1.0.0
each): >>> custom_db = peewee.SqliteDatabase(’custom.db’) >>> class CustomModel(peewee.Model): ... whatev = peewee.CharField() ... ... class Meta: ... database = custom_db ... >>> custom_db.connect() use, and then all your models will extend it: custom_db = peewee.SqliteDatabase(’custom.db’) class CustomModel(peewee.Model): class Meta: database = custom_db class Blog(CustomModel): 1.3. Peewee Cookbook entries: query = Blog.select().join(Entry, ’left outer’).annotate(Entry) You can also specify a custom aggregator: query = Blog.select().annotate(Entry, peewee.Max(’pub_date’, ’max_pub_date’)) Let’s0 码力 | 71 页 | 405.29 KB | 1 年前3peewee Documentation Release 2.10.2
supports and the parameters they accept. There is also an extension module that contains special/custom field types. Contents: Installing and Testing Installing with git Running tests Optional dependencies Metadata Types Misc Hacks Optimistic Locking Top object per group Top N objects per group Writing custom functions with SQLite Note If you find any bugs, odd behavior, or have an idea for a new feature provides many SQLite-specific features such as: Full-text search with BM25 ranking. Support for custom functions, aggregates and collations Advanced transaction support And more! If you would like to0 码力 | 275 页 | 276.96 KB | 1 年前3peewee Documentation Release 2.10.2
supports and the parameters they accept. There is also an extension module that contains special/custom field types. Contents 1 peewee Documentation, Release 2.10.2 2 Contents CHAPTER 1 Contents: provides many SQLite-specific fea- tures such as: • Full-text search with BM25 ranking. • Support for custom functions, aggregates and collations • Advanced transaction support • And more! If you would like compling the BerkeleyDB + SQLite library, then building a statically-linked pysqlite that uses the custom sqlite library. To connect to a BerkeleyDB database, we will use BerkeleyDatabase. Like SqliteDatabase0 码力 | 221 页 | 844.06 KB | 1 年前3peewee Documentation Release 0.9.7
>>> custom_db = peewee.SqliteDatabase('custom.db') >>> class CustomModel(peewee.Model): ... whatev = peewee.CharField() ... ... class Meta: ... database = custom_db ... >>> custom_db and then all your models will extend it: custom_db = peewee.SqliteDatabase('custom.db') class CustomModel(peewee.Model): class Meta: database = custom_db class Blog(CustomModel): creator entries: query = Blog.select().join(Entry, 'left outer').annotate(Entry) You can also specify a custom aggregator: query = Blog.select().annotate(Entry, peewee.Max('pub_date', 'max_pub_date')) Let’s0 码力 | 78 页 | 143.68 KB | 1 年前3peewee Documentation Release 0.9.7
each): >>> custom_db = peewee.SqliteDatabase(’custom.db’) >>> class CustomModel(peewee.Model): ... whatev = peewee.CharField() ... ... class Meta: ... database = custom_db ... >>> custom_db.connect() use, and then all your models will extend it: custom_db = peewee.SqliteDatabase(’custom.db’) class CustomModel(peewee.Model): class Meta: database = custom_db class Blog(CustomModel): creator = peewee entries: query = Blog.select().join(Entry, ’left outer’).annotate(Entry) You can also specify a custom aggregator: query = Blog.select().annotate(Entry, peewee.Max(’pub_date’, ’max_pub_date’)) Let’s0 码力 | 53 页 | 347.03 KB | 1 年前3peewee Documentation Release 2.0.2
models from each): >>> custom_db = SqliteDatabase(’custom.db’) >>> class CustomModel(Model): ... whatev = CharField() ... ... class Meta: ... database = custom_db ... >>> custom_db.connect() >>> CustomModel wish to use, and then all your models will extend it: custom_db = SqliteDatabase(’custom.db’) class CustomModel(Model): class Meta: database = custom_db class User(CustomModel): username = CharField() tweets: query = User.select().join(Tweet, JOIN_LEFT_OUTER).annotate(Tweet) You can also specify a custom aggregator: query = User.select().annotate(Tweet, fn.Max(Tweet.created_date).alias(’latest’)) Let’s0 码力 | 65 页 | 315.33 KB | 1 年前3peewee Documentation Release 3.5.0
supports and the parameters they accept. There is also an extension module that contains special/custom field types. Contents: Installing and Testing Installing with git Running tests Optional dependencies Query Objects More Hacks Optimistic Locking Top object per group Top N objects per group Writing custom functions with SQLite Changes in 3.0 Backwards-incompatible New stuff Note If you find any bugs middleware gets executed, add it to your settings module: # settings.py MIDDLEWARE_CLASSES = ( # Our custom middleware appears first in the list. 'my_blog.middleware.PeeweeConnectionMiddleware', # These0 码力 | 347 页 | 380.80 KB | 1 年前3peewee Documentation Release 3.4.0
supports and the parameters they accept. There is also an extension module that contains special/custom field types. Contents: Installing and Testing Installing with git Running tests Optional dependencies Query Objects More Hacks Optimistic Locking Top object per group Top N objects per group Writing custom functions with SQLite Note If you find any bugs, odd behavior, or have an idea for a new feature middleware gets executed, add it to your settings module: # settings.py MIDDLEWARE_CLASSES = ( # Our custom middleware appears first in the list. 'my_blog.middleware.PeeweeConnectionMiddleware', # These0 码力 | 349 页 | 382.34 KB | 1 年前3peewee Documentation Release 3.5.0
supports and the parameters they accept. There is also an extension module that contains special/custom field types. Contents 1 peewee Documentation, Release 3.5.0 2 Contents CHAPTER 1 Contents: middleware gets executed, add it to your settings module: # settings.py MIDDLEWARE_CLASSES = ( # Our custom middleware appears first in the list. 'my_blog.middleware.PeeweeConnectionMiddleware', # These are field you’re looking for in the above table? It’s easy to create custom field types and use them with your models. • Creating a custom field • Database, particularly the fields parameter. Field initialization0 码力 | 282 页 | 1.02 MB | 1 年前3
共 16 条
- 1
- 2