peewee Documentation Release 3.4.0
begin with your data model, by defining one or more Model classes: from peewee import * db = SqliteDatabase('people.db') class Person(Model): name = CharField() birthday = DateField() is_relative = BooleanField() peewee Documentation, Release 3.4.0 In order to create these models we need to instantiate a SqliteDatabase object. Then we define our model classes, specifying the columns as Field instances on the class peewee database instance -- our models will use this database to # persist information database = SqliteDatabase(DATABASE) # model definitions -- the standard "pattern" is to define a base model class # that0 码力 | 284 页 | 1.03 MB | 1 年前3peewee Documentation Release 3.5.0
begin with your data model, by defining one or more Model classes: from peewee import * db = SqliteDatabase('people.db') class Person(Model): name = CharField() birthday = DateField() is_relative = BooleanField() peewee Documentation, Release 3.5.0 In order to create these models we need to instantiate a SqliteDatabase object. Then we define our model classes, specifying the columns as Field instances on the class peewee database instance -- our models will use this database to # persist information database = SqliteDatabase(DATABASE) # model definitions -- the standard "pattern" is to define a base model class # that0 码力 | 282 页 | 1.02 MB | 1 年前3peewee Documentation Release 3.3.0
begin with your data model, by defining one or more Model classes: from peewee import * db = SqliteDatabase('people.db') class Person(Model): name = CharField() birthday = DateField() is_relative = BooleanField() peewee Documentation, Release 3.3.0 In order to create these models we need to instantiate a SqliteDatabase object. Then we define our model classes, specifying the columns as Field instances on the class peewee database instance -- our models will use this database to # persist information database = SqliteDatabase(DATABASE) # model definitions -- the standard "pattern" is to define a base model class # that0 码力 | 280 页 | 1.02 MB | 1 年前3peewee Documentation Release 3.6.0
begin with your data model, by defining one or more Model classes: from peewee import * db = SqliteDatabase('people.db') class Person(Model): name = CharField() birthday = DateField() class Meta: database these are the tables and relationships: In order to create these models we need to instantiate a SqliteDatabase object. Then we define our model classes, specifying the columns as Field instances on the class peewee database instance -- our models will use this database to # persist information database = SqliteDatabase(DATABASE) # model definitions -- the standard "pattern" is to define a base model class # that0 码力 | 302 页 | 1.02 MB | 1 年前3peewee Documentation Release 2.10.2
begin with your data model, by defining one or more Model classes: from peewee import * db = SqliteDatabase('people.db') class Person(Model): name = CharField() birthday = DateField() is_relative = BooleanField() these are the tables and relationships: In order to create these models we need to instantiate a SqliteDatabase object. Then we define our model classes, specifying the columns as Field instances on the class peewee database instance -- our models will use this database to # persist information database = SqliteDatabase(DATABASE) # model definitions -- the standard "pattern" is to define a base model class # that0 码力 | 221 页 | 844.06 KB | 1 年前3peewee Documentation Release 2.0.2
I chose to consolidate these two classes, since inevitably they always went in pairs (e.g. SqliteDatabase/SqliteAdapter). The database class now encapsulates all this functionality. 1.3.5 How the SQL “connect” step, rather than some 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 use multiple databases (provided that you don’t try and mix models from each): >>> custom_db = SqliteDatabase(’custom.db’) >>> class CustomModel(Model): ... whatev = CharField() ... ... class Meta: .0 码力 | 65 页 | 315.33 KB | 1 年前3peewee Documentation Release 1.0.0
“connect” step, rather than some 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 multiple databases (provided that you don’t try and mix models from each): >>> custom_db = peewee.SqliteDatabase(’custom.db’) >>> class CustomModel(peewee.Model): ... whatev = peewee.CharField() ... ... class database object you wish to 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):0 码力 | 71 页 | 405.29 KB | 1 年前3peewee Documentation Release 0.9.7
database = SqliteDatabase(’stats.db’) >>> database.connect() It is possible to use multiple databases (provided that you don’t try and mix models from each): >>> custom_db = peewee.SqliteDatabase(’custom database object you wish to 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): single connection per-thread, instantiate your database with threadlocals=True: concurrent_db = SqliteDatabase(’stats.db’, threadlocals=True) Deferring initialization Sometimes the database information0 码力 | 53 页 | 347.03 KB | 1 年前3SQLite in Android
32 Android SQLiteDatabase 33 A class to use SQLite. SQLiteDatabase db = openOrCreateDatabase( "name", MODE_PRIVATE, null); db.execSQL("SQL query"); Android SQLiteDatabase 34 It helps0 码力 | 40 页 | 707.67 KB | 1 年前3SQLite Tutorial
rules as needed. if (preg_match("/^\w{8,20}$/", $_GET['username'], $matches)){ $db = new SQLiteDatabase('filename'); $result = @$db->query("SELECT * FROM users WHERE username=$matches[0]"); }else{0 码力 | 172 页 | 1.27 MB | 1 年前3
共 10 条
- 1