peewee Documentation Release 3.0.0
# SQLite database using WAL journal mode and 64MB cache. sqlite_db = SqliteDatabase('/path/to/app.db', pragmas=( ('journal_mode', 'wal'), ('cache_size', -1024 * 64))) # Connect to a MySQL database pragma name and value: db = SqliteDatabase('my_app.db', pragmas=( ('journal_mode', 'WAL'), ('cache_size', 10000), ('mmap_size', 1024 * 1024 * 32), )) PRAGMAs may also be configured dynamically Set cache size to 64MB for current connection. db.pragma('cache_size', -1024 * 64) # Same as above. db.cache_size = -1024 * 64 # Read the value of several pragmas: print('cache_size:', db.cache_size)0 码力 | 319 页 | 361.50 KB | 1 年前3peewee Documentation Release 3.4.0
# SQLite database using WAL journal mode and 64MB cache. sqlite_db = SqliteDatabase('/path/to/app.db', pragmas=( ('journal_mode', 'wal'), ('cache_size', -1024 * 64))) # Connect to a MySQL database pragma name and value: db = SqliteDatabase('my_app.db', pragmas=( ('journal_mode', 'WAL'), ('cache_size', 10000), ('mmap_size', 1024 * 1024 * 32), )) PRAGMAs may also be configured dynamically Set cache size to 64MB for current connection. db.pragma('cache_size', -1024 * 64) # Same as above. db.cache_size = -1024 * 64 # Read the value of several pragmas: print('cache_size:', db.cache_size)0 码力 | 349 页 | 382.34 KB | 1 年前3peewee Documentation Release 3.1.0
# SQLite database using WAL journal mode and 64MB cache. sqlite_db = SqliteDatabase('/path/to/app.db', pragmas=( ('journal_mode', 'wal'), ('cache_size', -1024 * 64))) # Connect to a MySQL database pragma name and value: db = SqliteDatabase('my_app.db', pragmas=( ('journal_mode', 'WAL'), ('cache_size', 10000), ('mmap_size', 1024 * 1024 * 32), )) PRAGMAs may also be configured dynamically Set cache size to 64MB for current connection. db.pragma('cache_size', -1024 * 64) # Same as above. db.cache_size = -1024 * 64 # Read the value of several pragmas: print('cache_size:', db.cache_size)0 码力 | 332 页 | 370.77 KB | 1 年前3peewee Documentation Release 3.3.0
* # SQLite database using WAL journal mode and 64MB cache. sqlite_db = SqliteDatabase('/path/to/app.db', pragmas=( ('journal_mode', 'wal'), ('cache_size', -1024 * 64))) # Connect to a MySQL database on the pragma name and value: db = SqliteDatabase('my_app.db', pragmas=( ('journal_mode', 'WAL'), ('cache_size', 10000), ('mmap_size', 1024 * 1024 * 32), )) 1.6. Database 41 peewee Documentation, Release Set cache size to 64MB for current connection. db.pragma('cache_size', -1024 * 64) # Same as above. db.cache_size = -1024 * 64 # Read the value of several pragmas: print('cache_size:', db.cache_size)0 码力 | 280 页 | 1.02 MB | 1 年前3peewee Documentation Release 3.4.0
* # SQLite database using WAL journal mode and 64MB cache. sqlite_db = SqliteDatabase('/path/to/app.db', pragmas=( ('journal_mode', 'wal'), ('cache_size', -1024 * 64))) # Connect to a MySQL database on the pragma name and value: db = SqliteDatabase('my_app.db', pragmas=( ('journal_mode', 'WAL'), ('cache_size', 10000), ('mmap_size', 1024 * 1024 * 32), )) PRAGMAs may also be configured dynamically using Set cache size to 64MB for current connection. db.pragma('cache_size', -1024 * 64) # Same as above. db.cache_size = -1024 * 64 # Read the value of several pragmas: print('cache_size:', db.cache_size)0 码力 | 284 页 | 1.03 MB | 1 年前3peewee Documentation Release 3.6.0
# SQLite database using WAL journal mode and 64MB cache. sqlite_db = SqliteDatabase('/path/to/app.db', pragmas={ 'journal_mode': 'wal', 'cache_size': -1024 * 64}) # Connect to a MySQL database SqliteExtDatabase('my_app.db', pragmas={ 'journal_mode': 'wal', # WAL-mode. 'cache_size': -64 * 1000, # 64MB cache. 'synchronous': 0}) # Let the OS manage syncing. PRAGMA statements SQLite allows pragma name and value: db = SqliteDatabase('my_app.db', pragmas={ 'journal_mode': 'wal', 'cache_size': 10000, # 10000 pages, or ~40MB 'foreign_keys': 1, # Enforce foreign-key constraints })0 码力 | 377 页 | 399.12 KB | 1 年前3peewee Documentation Release 3.6.0
specific configuration options. from peewee import * # SQLite database using WAL journal mode and 64MB cache. sqlite_db = SqliteDatabase('/path/to/app.db', pragmas={ (continues on next page) 18 Chapter 1. Contents: peewee Documentation, Release 3.6.0 (continued from previous page) 'journal_mode': 'wal', 'cache_size': -1024 * 64}) # Connect to a MySQL database on network. mysql_db = MySQLDatabase('my_app', = SqliteExtDatabase('my_app.db', pragmas={ 'journal_mode': 'wal', # WAL-mode. 'cache_size': -64 * 1000, # 64MB cache. 'synchronous': 0}) # Let the OS manage syncing. PRAGMA statements SQLite allows0 码力 | 302 页 | 1.02 MB | 1 年前3peewee Documentation Release 3.5.0
# SQLite database using WAL journal mode and 64MB cache. sqlite_db = SqliteDatabase('/path/to/app.db', pragmas={ 'journal_mode': 'wal', 'cache_size': -1024 * 64}) # Connect to a MySQL database SqliteExtDatabase('my_app.db', pragmas={ 'journal_mode': 'wal', # WAL-mode. 'cache_size': -64 * 1000, # 64MB cache. 'synchronous': 0}) # Let the OS manage syncing. PRAGMA statements SQLite allows pragma name and value: db = SqliteDatabase('my_app.db', pragmas={ 'journal_mode': 'wal', 'cache_size': 10000, # 10000 pages, or ~40MB 'foreign_keys': 1, # Enforce foreign-key constraints })0 码力 | 347 页 | 380.80 KB | 1 年前3peewee Documentation Release 3.5.0
* # SQLite database using WAL journal mode and 64MB cache. sqlite_db = SqliteDatabase('/path/to/app.db', pragmas={ 'journal_mode': 'wal', 'cache_size': -1024 * 64}) # Connect to a MySQL database on = SqliteExtDatabase('my_app.db', pragmas={ 'journal_mode': 'wal', # WAL-mode. 'cache_size': -64 * 1000, # 64MB cache. 'synchronous': 0}) # Let the OS manage syncing. PRAGMA statements SQLite allows containing the pragma name and value: db = SqliteDatabase('my_app.db', pragmas={ 'journal_mode': 'wal', 'cache_size': 10000, # 10000 pages, or ~40MB 'foreign_keys': 1, # Enforce foreign-key constraints }) PRAGMAs0 码力 | 282 页 | 1.02 MB | 1 年前3peewee Documentation Release 2.10.2
pragma name and value: db = SqliteDatabase('my_app.db', pragmas=( ('journal_mode', 'WAL'), ('cache_size', 10000), ('mmap_size', 1024 * 1024 * 32), )) SQLite and Autocommit Changed in version function), a separate connection will be used for the duration of the wrapped block. You can also choose whether to wrap the block in a transaction. Execution context examples: with db.execution_context() Additionally, a # transaction will be started. user = User.create(username='charlie') # When the block ends, the transaction will be committed and the connection # will be closed (or returned to the pool)0 码力 | 275 页 | 276.96 KB | 1 年前3
共 16 条
- 1
- 2