我的选择有效,但我的更新和删除不起作用。在
db_jb = create_engine(jb)
self.jobs = Table('Job', MetaData(jb), autoload=True)
# select - works
ss = select(self.jobs).where(
self.jobs.c.job_guid == jobGuid
).limit(1)
rs = ss.execute()
rows = [r for r in rs]
rs.close()
# update - does not work
su = update(self.jobs, mysql_limit=1).where(
self.jobs.c.job_guid == jobGuid
).values(jobStatus=status)
# does not have an affect
su.execution_options(autocommit=True)
rs = su.execute()
rs.close()
修改su
变量,查询是正确的,但它没有被提交
如何在不使用会话的情况下提交更改?在
您是否尝试将
COMMIT
作为原始语句执行,例如您还可以将
db_jb.execute('BEGIN')
放在ss = ...
之前显式地启动一个事务相关问题 更多 >
编程相关推荐