更新时间:2023-11-25 20:33:46
Read Inserts, Updates and Deletes section of the documentation. Following code should get you started:
from sqlalchemy.sql.expression import bindparam
stmt = addresses.update().\
where(addresses.c.id == bindparam('_id')).\
values({
'user_id': bindparam('user_id'),
'email_address': bindparam('email_address'),
})
conn.execute(stmt, [
{'user_id': 1, 'email_address' : 'jack@yahoo.com', '_id':1},
{'user_id': 1, 'email_address' : 'jack@msn.com', '_id':2},
{'user_id': 2, 'email_address' : 'www@www.org', '_id':3},
{'user_id': 2, 'email_address' : 'wendy@aol.com', '_id':4},
])