G
G
gadzhi152016-04-06 21:28:54
Python
gadzhi15, 2016-04-06 21:28:54

Update data in sqllite table in python?

There is sqlite table time. It has a column called Deleted. It contains a string value.
In Python, I read a string value and then compare it to some variable. If the value in the table is less than the variable, then write the value of the variable to the place of the value in the table.
Question: how to specify a Python variable in a sql query to overwrite?

c.execute('UPDATE time SET Deleted = date where rowid = 1')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Kitaev, 2016-04-06
@gadzhi15

c.execute('UPDATE time SET Deleted = ? where rowid = 1', ['hello world'])

https://docs.python.org/3/library/sqlite3.html#sql...
https://www.sqlite.org/lang_update.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question