直接更新SQLalchemy类并获取实例

时间:2019-04-05 08:43:50

标签: python sqlalchemy

我想直接更新我的sqlalchemy类,然后将更改插入数据库并返回最近插入的ID。下面是我要工作的代码。

Series.is_forfeited = is_forfeited
Series.start_date_time =date_time
Series.is_finished = is_finished
Series.is_live = is_live

instance = 'Convert newly updated object to instance'
session.add(instance)


session.commit()
id = instance.id

1 个答案:

答案 0 :(得分:0)

好像您没有初始化实例。试试这个:

setDT(df2)[df1, on = .(ID, date > start_date, date <= end_date)]