peewee Documentation Release 2.10.2to database concepts: Thing Corresponds to… Model class Database table Field instance Column on a table Model instance Row in a database table When starting a project with peewee, it’s typically best 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, it is good practice connection when you are done – for instance, a web app might open a connection when it receives a request, and close the connection when it sends the response. >>> db.connect() We’ll begin by creating the0 码力 | 275 页 | 276.96 KB | 1 年前3
peewee Documentation
Release 2.10.2database concepts: Thing Corresponds to. . . Model class Database table Field instance Column on a table Model instance Row in a database table When starting a project with peewee, it’s typically best 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, it is good practice connection when you are done – for instance, a web app might open a connection when it receives a request, and close the connection when it sends the response. >>> db.connect() We’ll begin by creating the0 码力 | 221 页 | 844.06 KB | 1 年前3
peewee Documentation Release 1.0.0to explicitly connect to the database before using it, managing connections explicitly is a good practice. This way if the connection fails, the exception can be caught during the “connect” step, rather arbitrary time later when a query is executed. >>> database = SqliteDatabase('stats.db') >>> database.connect() To use this database with your models, specify it in an inner “Meta” class: class MyModel(Model): = peewee.CharField() ... ... class Meta: ... database = custom_db ... >>> custom_db.connect() >>> CustomModel.create_table() Best practice: define a base model class that points at the database0 码力 | 101 页 | 163.20 KB | 1 年前3
peewee Documentation
Release 1.0.0to explicitly connect to the database before using it, managing connections explicitly is a good practice. This way if the connection fails, the exception can be caught during the “connect” step, rather arbitrary time later when a query is executed. >>> database = SqliteDatabase(’stats.db’) >>> database.connect() To use this database with your models, specify it in an inner “Meta” class: class MyModel(Model): whatev = peewee.CharField() ... ... class Meta: ... database = custom_db ... >>> custom_db.connect() >>> CustomModel.create_table() Best practice: define a base model class that points at the database0 码力 | 71 页 | 405.29 KB | 1 年前3
peewee Documentation
Release 2.0.2to explicitly connect to the database before using it, managing connections explicitly is a good practice. This way if the connection fails, the exception can be caught during the “connect” step, rather arbitrary time later when a query is executed. >>> database = SqliteDatabase(’stats.db’) >>> database.connect() To use this database with your models, specify it in an inner “Meta” class: class MyModel(Model): CustomModel(Model): ... whatev = CharField() ... ... class Meta: ... database = custom_db ... >>> custom_db.connect() >>> CustomModel.create_table() Best practice: define a base model class that points at the database0 码力 | 65 页 | 315.33 KB | 1 年前3
peewee Documentation Release 3.0.0to database concepts: Object Corresponds to… Model class Database table Field instance Column on a table Model instance Row in a database table When starting a project with peewee, it’s typically best 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, it is good practice connection when you are done – for instance, a web app might open a connection when it receives a request, and close the connection when it sends the response. db.connect() We’ll begin by creating the tables0 码力 | 319 页 | 361.50 KB | 1 年前3
peewee Documentation Release 3.4.0to database concepts: Object Corresponds to… Model class Database table Field instance Column on a table Model instance Row in a database table When starting a project with peewee, it’s typically best 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, it is good practice connection when you are done – for instance, a web app might open a connection when it receives a request, and close the connection when it sends the response. db.connect() We’ll begin by creating the tables0 码力 | 349 页 | 382.34 KB | 1 年前3
peewee Documentation
Release 3.5.0to database concepts: Object Corresponds to… Model class Database table Field instance Column on a table Model instance Row in a database table When starting a project with peewee, it’s typically best 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, it is good practice connection when you are done – for instance, a web app might open a connection when it receives a request, and close the connection when it sends the response. db.connect() We’ll begin by creating the tables0 码力 | 347 页 | 380.80 KB | 1 年前3
peewee Documentation Release 3.1.0to database concepts: Object Corresponds to… Model class Database table Field instance Column on a table Model instance Row in a database table When starting a project with peewee, it’s typically best 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, it is good practice connection when you are done – for instance, a web app might open a connection when it receives a request, and close the connection when it sends the response. db.connect() We’ll begin by creating the tables0 码力 | 332 页 | 370.77 KB | 1 年前3
peewee Documentation
Release 3.3.0database concepts: Object Corresponds to. . . Model class Database table Field instance Column on a table Model instance Row in a database table When starting a project with peewee, it’s typically best 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, it is good practice connection when you are done – for instance, a web app might open a connection when it receives a request, and close the connection when it sends the response. db.connect() We’ll begin by creating the tables0 码力 | 280 页 | 1.02 MB | 1 年前3
共 16 条
- 1
- 2













