peewee Documentation
Release 3.5.0. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 1.6 Models and Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . in your code without having to worry. Things get interesting when we set up relationships between models using foreign keys (wikipedia). This is easy to do with peewee: class Pet(Model): owner = ForeignKeyField(Person CharField() class Meta: database = db # this model uses the "people.db" database Now that we have our models, let’s connect to the database. Although it’s not necessary to open the connection explicitly, it0 码力 | 282 页 | 1.02 MB | 1 年前3
peewee Documentation
Release 3.3.0. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 1.7 Models and Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . in your code without having to worry. Things get interesting when we set up relationships between models using foreign keys (wikipedia). This is easy to do with peewee: class Pet(Model): owner = ForeignKeyField(Person CharField() class Meta: database = db # this model uses the "people.db" database Now that we have our models, let’s connect to the database. Although it’s not necessary to open the connection explicitly, it0 码力 | 280 页 | 1.02 MB | 1 年前3
peewee Documentation
Release 3.4.0. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 1.7 Models and Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . in your code without having to worry. Things get interesting when we set up relationships between models using foreign keys (wikipedia). This is easy to do with peewee: class Pet(Model): owner = ForeignKeyField(Person CharField() class Meta: database = db # this model uses the "people.db" database Now that we have our models, let’s connect to the database. Although it’s not necessary to open the connection explicitly, it0 码力 | 284 页 | 1.03 MB | 1 年前3
peewee Documentation
Release 3.5.0Executing Queries Managing Transactions Database Errors Logging queries Adding a new Database Driver Models and Fields Fields Creating model tables Model options and table metadata Indexes and Constraints in your code without having to worry. Things get interesting when we set up relationships between models using foreign keys (wikipedia) [http://en.wikipedia.org/wiki/Foreign_key]. This is easy to do with class Meta: database = db # this model uses the "people.db" database Now that we have our models, let’s connect to the database. Although it’s not necessary to open the connection explicitly, it0 码力 | 347 页 | 380.80 KB | 1 年前3
peewee Documentation Release 3.4.0Executing Queries Managing Transactions Database Errors Logging queries Adding a new Database Driver Models and Fields Fields Field-naming conflicts Creating model tables Model options and table metadata in your code without having to worry. Things get interesting when we set up relationships between models using foreign keys (wikipedia) [http://en.wikipedia.org/wiki/Foreign_key]. This is easy to do with class Meta: database = db # this model uses the "people.db" database Now that we have our models, let’s connect to the database. Although it’s not necessary to open the connection explicitly, it0 码力 | 349 页 | 382.34 KB | 1 年前3
peewee Documentation
Release 3.6.0. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 1.6 Models and Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . source code hosted on GitHub. New to peewee? These may help: • Quickstart • Example twitter app • Models and fields • Querying • Relationships and joins Contents 1 peewee Documentation, Release 3.6 in your code without having to worry. Things get interesting when we set up relationships between models using foreign key relationships. This is simple with peewee: class Pet(Model): owner = ForeignKeyField(Person0 码力 | 302 页 | 1.02 MB | 1 年前3
peewee Documentation Release 3.6.0[https://github.com/coleifer/peewee]. New to peewee? These may help: Quickstart Example twitter app Models and fields Querying Relationships and joins Contents: Installing and Testing Installing with git Executing Queries Managing Transactions Database Errors Logging queries Adding a new Database Driver Models and Fields Fields Creating model tables Model options and table metadata Indexes and Constraints in your code without having to worry. Things get interesting when we set up relationships between models using foreign key relationships. This is simple with peewee: class Pet(Model): owner = ForeignKeyField(Person0 码力 | 377 页 | 399.12 KB | 1 年前3
peewee Documentation Release 1.0.0the ways to perform typical database-related tasks with peewee. Examples will use the following models: import peewee class Blog(peewee.Model): creator = peewee.CharField() name = peewee.CharField() >>> database = SqliteDatabase('stats.db') >>> database.connect() To use this database with your models, specify it in an inner “Meta” class: class MyModel(Model): some_field = CharField() class database = database It is possible to use multiple databases (provided that you don’t try and mix models from each): >>> custom_db = peewee.SqliteDatabase('custom.db') >>> class CustomModel(peewee.Model):0 码力 | 101 页 | 163.20 KB | 1 年前3
peewee Documentation
Release 1.0.0the ways to perform typical database-related tasks with peewee. Examples will use the following models: 4 Chapter 1. Contents: peewee Documentation, Release 1.0.0 import peewee class Blog(peewee.Model): >>> database = SqliteDatabase(’stats.db’) >>> database.connect() To use this database with your models, specify it in an inner “Meta” class: class MyModel(Model): some_field = CharField() class Meta: database = database It is possible to use multiple databases (provided that you don’t try and mix models from each): >>> custom_db = peewee.SqliteDatabase(’custom.db’) >>> class CustomModel(peewee.Model):0 码力 | 71 页 | 405.29 KB | 1 年前3
peewee Documentation
Release 2.0.2Since seeing is believing, I will show some side-by-side comparisons. Let’s pretend we’re using the models from the cookbook, good ol’ user and tweet: class User(Model): username = CharField() class Tweet(Model): the ways to perform typical 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): >>> database = SqliteDatabase(’stats.db’) >>> database.connect() To use this database with your models, specify it in an inner “Meta” class: class MyModel(Model): some_field = CharField() class Meta:0 码力 | 65 页 | 315.33 KB | 1 年前3
共 16 条
- 1
- 2













