Flask Documentation (1.1.x)provide a so called “session transaction” which simulates the appropriate calls to open a session in the context of the test client and to modify it. At the end of the transaction the session is stored and works independently of the session backend used: with app.test_client() as c: with c.session_transaction() as sess: sess['a_key'] = 'a value' # once this is reached the session was stored and insert data you can use the insert method. We have to get a connection first so that we can use a transaction: >>> con = engine.connect() >>> con.execute(users.insert(), name='admin', email='admin@localhost')0 码力 | 428 页 | 895.98 KB | 1 年前3
Flask Documentation (1.1.x)provide a so called “session transaction” which simulates the appropriate calls to open a session in the context of the test client and to modify it. At the end of the transaction the session is stored and works independently of the session backend used: with app.test_client() as c: with c.session_transaction() as sess: sess['a_key'] = 'a value' # once this is reached the session was stored and ready to insert data you can use the insert method. We have to get a connection first so that we can use a transaction: >>> con = engine.connect() >>> con.execute(users.insert(), name='admin', email='admin@localhost')0 码力 | 291 页 | 1.25 MB | 1 年前3
共 2 条
- 1
相关搜索词













