peewee Documentation Release 2.10.2
BerkeleyDB Using MySQL Connecting using a Database URL Multi-threaded applications Run-time database configuration Dynamically defining a database Connection Pooling Read Slaves Schema migrations Generating Models p.db', journal_mode='WAL') PRAGMA statements New in version 2.6.4. SQLite allows run-time configuration of a number of parameters through PRAGMA statements (documentation [https://www.sqlite.org/pragma threadlocals=False. Run-time database configuration Sometimes the database connection settings are not known until run-time, when these values may be loaded from a configuration file or the environment. In these0 码力 | 275 页 | 276.96 KB | 1 年前3peewee Documentation Release 2.10.2
2.6.4. 20 Chapter 1. Contents: peewee Documentation, Release 2.10.2 SQLite allows run-time configuration of a number of parameters through PRAGMA statements (documentation). These statements are typically 10.2 1.6.8 Run-time database configuration Sometimes the database connection settings are not known until run-time, when these values may be loaded from a configuration file or the environment. In these database_proxy # Use proxy for our DB. class User(BaseModel): username = CharField() # Based on configuration, use a different database. if app.config['DEBUG']: database = SqliteDatabase('local.db') elif0 码力 | 221 页 | 844.06 KB | 1 年前3peewee Documentation Release 0.9.7
Sometimes the database information is not known until run-time, when it might be loaded from a configuration file/etc. In this case, you can “defer” the initialization of the database by passing in None number of related objects. For this example we’ll use some different models in a Many-To-Many configuration: class Photo(Model): image = CharField() class Tag(Model): name = CharField() class database = db Model configuration is kept namespaced in a special class called Meta – this convention is borrowed from Django, which does the same thing. Meta configuration is passed on to subclasses0 码力 | 78 页 | 143.68 KB | 1 年前3peewee Documentation Release 0.9.7
Sometimes the database information is not known until run-time, when it might be loaded from a configuration file/etc. In this case, you can “defer” the initialization of the database by passing in None number of related objects. For this example we’ll use some different models in a Many-To-Many configuration: class Photo(Model): image = CharField() class Tag(Model): name = CharField() class PhotoTag(Model): Meta: database = db Model configuration is kept namespaced in a special class called Meta – this convention is borrowed from Django, which does the same thing. Meta configuration is passed on to subclasses0 码力 | 53 页 | 347.03 KB | 1 年前3peewee Documentation Release 3.5.0
Database Using Postgresql Using SQLite Using MySQL Connecting using a Database URL Run-time database configuration Dynamically defining a database Connection Management Connection Pooling Testing Peewee Applications support for SQLite, MySQL and Postgres. Each database class provides some basic, database-specific configuration options. from peewee import * # SQLite database using WAL journal mode and 64MB cache. sqlite_db 'synchronous': 0}) # Let the OS manage syncing. PRAGMA statements SQLite allows run-time configuration of a number of parameters through PRAGMA statements (documentation [https://www.sqlite.org/pragma0 码力 | 347 页 | 380.80 KB | 1 年前3peewee Documentation Release 3.4.0
Database Using Postgresql Using SQLite Using MySQL Connecting using a Database URL Run-time database configuration Dynamically defining a database Connection Management Connection Pooling Testing Peewee Applications support for SQLite, MySQL and Postgres. Each database class provides some basic, database-specific configuration options. from peewee import * # SQLite database using WAL journal mode and 64MB cache. sqlite_db SqliteExtDatabase('my_app.db', journal_mode='WAL') PRAGMA statements SQLite allows run-time configuration of a number of parameters through PRAGMA statements (documentation [https://www.sqlite.org/pragma0 码力 | 349 页 | 382.34 KB | 1 年前3peewee Documentation Release 3.6.0
Database Using Postgresql Using SQLite Using MySQL Connecting using a Database URL Run-time database configuration Dynamically defining a database Connection Management Connection Pooling Testing Peewee Applications support for SQLite, MySQL and Postgres. Each database class provides some basic, database-specific configuration options. from peewee import * # SQLite database using WAL journal mode and 64MB cache. sqlite_db 'synchronous': 0}) # Let the OS manage syncing. PRAGMA statements SQLite allows run-time configuration of a number of parameters through PRAGMA statements (SQLite documentation [https://www.sqlite0 码力 | 377 页 | 399.12 KB | 1 年前3peewee Documentation Release 3.0.0
Database Using Postgresql Using SQLite Using MySQL Connecting using a Database URL Run-time database configuration Dynamically defining a database Connection Management Connection Pooling Framework Integration support for SQLite, MySQL and Postgres. Each database class provides some basic, database-specific configuration options. from peewee import * # SQLite database using WAL journal mode and 64MB cache. sqlite_db SqliteExtDatabase('my_app.db', journal_mode='WAL') PRAGMA statements SQLite allows run-time configuration of a number of parameters through PRAGMA statements (documentation [https://www.sqlite.org/pragma0 码力 | 319 页 | 361.50 KB | 1 年前3peewee Documentation Release 2.0.2
Sometimes the database information is not known until run-time, when it might be loaded from a configuration file/etc. In this case, you can “defer” the initialization of the database by passing in None number of related objects. For this example we’ll use some different models in a Many-To-Many configuration: class Photo(Model): image = CharField() class Tag(Model): name = CharField() class PhotoTag(Model): Meta: database = db Model configuration is kept namespaced in a special class called Meta – this convention is borrowed from Django, which does the same thing. Meta configuration is passed on to subclasses0 码力 | 65 页 | 315.33 KB | 1 年前3peewee Documentation Release 3.1.0
Database Using Postgresql Using SQLite Using MySQL Connecting using a Database URL Run-time database configuration Dynamically defining a database Connection Management Connection Pooling Testing Peewee Applications support for SQLite, MySQL and Postgres. Each database class provides some basic, database-specific configuration options. from peewee import * # SQLite database using WAL journal mode and 64MB cache. sqlite_db SqliteExtDatabase('my_app.db', journal_mode='WAL') PRAGMA statements SQLite allows run-time configuration of a number of parameters through PRAGMA statements (documentation [https://www.sqlite.org/pragma0 码力 | 332 页 | 370.77 KB | 1 年前3
共 16 条
- 1
- 2