Я нуб с sqlite.
Я создал базу данных sqlite с таблицей питательных веществ, используя python (см. Структуру на снимке экрана).
![Screen shot of nutrients table](https://i.stack.imgur.com/g8FU7.png)
Я заполнил таблицу, используя
INSERT INTO nutrients ...
Однако я не могу обновить строку. Следующий код
import sqlite3
path = 'nutrition.sqlite'
command = 'SELECT user_name FROM nutrients WHERE code="ALCO"'
connection = sqlite3.connect(path)
cursor = connection.cursor()
cursor.execute(command)
rows = cursor.fetchall()
cursor.close()
connection.close()
print('before update', rows[0])
command = 'UPDATE nutrients SET user_name="Booze" WHERE code="ALCO"'
connection = sqlite3.connect(path)
cursor = connection.cursor()
cursor.execute(command)
cursor.close()
connection.close()
command = 'SELECT user_name FROM nutrients WHERE code="ALCO"'
connection = sqlite3.connect(path)
cursor = connection.cursor()
cursor.execute(command)
rows = cursor.fetchall()
cursor.close()
connection.close()
print('after update', rows[0])
производит вывод
('before update', (u'Alcohol',))
('after update', (u'Alcohol',))