要在sqlite表中插入的Python脚本

时间:2017-06-22 06:06:57

标签: python sqlite

我通过用户输入获取一些数据,然后我必须在sqlite表中插入相同的数据。

conn = sqlite.connect('c:/sqlite/test.db')
c = conn.cursor()

c.execute("Select Max(person_id) from persons")
person_id =c.fetchone()[0]

person_name = input ("Please provide User Name: ")
user_id= input("Please user_id table: ")
home_floor = input ("Please provide home floor for user: ")
start_dt= input("Please enter start date (yyyy-mm-dd) for User : ")
end_dt = input ("Please enter end date (yyyy-mm-dd) for User: ")

c.execute('insert into Person values (%s,%s,%s,%s,%s,%s) person_id,person_name,user_id,home_floor,start_dt,end_dt)

1 个答案:

答案 0 :(得分:-1)

改为使用 -

commit()

此外,插入后不要忘记conn.commit() 。在你的情况下它应该是 -

 fun run(): Completable {
    return Completable.concat(tasks.map { task ->
        task.run()
                .doOnComplete { logTaskCompletedSuccessfully(task) }
                .doOnError { error ->
                    logTaskFailed(task, error)
                }
    })
}