peewee Documentation Release 2.10.2SqliteMigrator(my_db) title_field = CharField(default='') status_field = IntegerField(null=True) with my_db.transaction(): migrate( migrator.add_column('some_table', 'title', title_field), 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
peewee Documentation
Release 2.10.2SqliteMigrator(my_db) title_field = CharField(default='') status_field = IntegerField(null=True) with my_db.transaction(): migrate( migrator.add_column('some_table', 'title', title_field), migrator.add 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() create(username='charlie') 1.6. Managing your Database 31 peewee Documentation, Release 2.10.2 # When the block ends, the transaction will be committed and the connection # will be closed (or returned to the pool)0 码力 | 221 页 | 844.06 KB | 1 年前3
peewee Documentation Release 3.4.0books in reverse order... Book.select().order_by(collate_reverse.collation(Book.title)) # Or... Book.select().order_by(Book.title.asc(collation='reverse')) Example user-defined table-value function (see TableFunction which opens a connection for the duration of the wrapped block of code. Additionally, a transaction is opened at the start of the wrapped block and committed before the connection is closed (unless an the wrapped block. Model.bind_ctx(), which likewise returns a context-manager that binds the model (and optionally its dependencies) to the given database for the duration of the wrapped block. Database0 码力 | 349 页 | 382.34 KB | 1 年前3
peewee Documentation Release 3.1.0books in reverse order... Book.select().order_by(collate_reverse.collation(Book.title)) # Or... Book.select().order_by(Book.title.asc(collation='reverse')) Example user-defined table-value function (see TableFunction which opens a connection for the duration of the wrapped block of code. Additionally, a transaction is opened at the start of the wrapped block and committed before the connection is closed (unless an the wrapped block. Model.bind_ctx(), which likewise returns a context-manager that binds the model (and optionally its dependencies) to the given database for the duration of the wrapped block. Database0 码力 | 332 页 | 370.77 KB | 1 年前3
peewee Documentation
Release 3.3.0books in reverse order... Book.select().order_by(collate_reverse.collation(Book.title)) # Or... Book.select().order_by(Book.title.asc(collation='reverse')) Example user-defined table-value function (see TableFunction which opens a connection for the duration of the wrapped block of code. Additionally, a transaction is opened at the start of the wrapped block and committed before the connection is closed (unless an wrapped block. • Model.bind_ctx(), which likewise returns a context-manager that binds the model (and optionally its dependencies) to the given database for the duration of the wrapped block. • Database0 码力 | 280 页 | 1.02 MB | 1 年前3
peewee Documentation
Release 3.4.0books in reverse order... Book.select().order_by(collate_reverse.collation(Book.title)) # Or... Book.select().order_by(Book.title.asc(collation='reverse')) Example user-defined table-value function (see TableFunction which opens a connection for the duration of the wrapped block of code. Additionally, a transaction is opened at the start of the wrapped block and committed before the connection is closed (unless an wrapped block. • Model.bind_ctx(), which likewise returns a context-manager that binds the model (and optionally its dependencies) to the given database for the duration of the wrapped block. • Database0 码力 | 284 页 | 1.03 MB | 1 年前3
peewee Documentation Release 3.0.0books in reverse order... Book.select().order_by(collate_reverse.collation(Book.title)) # Or... Book.select().order_by(Book.title.asc(collation='reverse')) For more information, see: SqliteDatabase.func() which opens a connection for the duration of the wrapped block of code. Additionally, a transaction is opened at the start of the wrapped block and committed before the connection is closed (unless an occurs in a wrapped block, the current transaction/savepoint will be rolled back. Otherwise the statements will be committed at the end of the wrapped block. Note While inside a block wrapped by the atomic()0 码力 | 319 页 | 361.50 KB | 1 年前3
peewee Documentation
Release 3.5.0books in reverse order... Book.select().order_by(collate_reverse.collation(Book.title)) # Or... Book.select().order_by(Book.title.asc(collation='reverse')) Example user-defined table-value function (see TableFunction which opens a connection for the duration of the wrapped block of code. Additionally, a transaction is opened at the start of the wrapped block and committed before the connection is closed (unless an the wrapped block. Model.bind_ctx(), which likewise returns a context-manager that binds the model (and optionally its dependencies) to the given database for the duration of the wrapped block. Database0 码力 | 347 页 | 380.80 KB | 1 年前3
peewee Documentation
Release 3.5.0books in reverse order... Book.select().order_by(collate_reverse.collation(Book.title)) # Or... Book.select().order_by(Book.title.asc(collation='reverse')) Example user-defined table-value function (see TableFunction which opens a connection for the duration of the wrapped block of code. Additionally, a transaction is opened at the start of the wrapped block and committed before the connection is closed (unless an wrapped block. • Model.bind_ctx(), which likewise returns a context-manager that binds the model (and optionally its dependencies) to the given database for the duration of the wrapped block. • Database0 码力 | 282 页 | 1.02 MB | 1 年前3
peewee Documentation Release 3.6.0books in reverse order... Book.select().order_by(collate_reverse.collation(Book.title)) # Or... Book.select().order_by(Book.title.asc(collation='reverse')) Example user-defined table-value function (see TableFunction which opens a connection for the duration of the wrapped block of code. Additionally, a transaction is opened at the start of the wrapped block and committed before the connection is closed (unless an the wrapped block. Model.bind_ctx(), which likewise returns a context-manager that binds the model (and optionally its dependencies) to the given database for the duration of the wrapped block. Database0 码力 | 377 页 | 399.12 KB | 1 年前3
共 16 条
- 1
- 2













