I am attempting to use sqlite3 through python commands in Visual Code Studio. After importing sqlite3, here is my code:
connection = sqlite3.connect("test.db")
crsr = connection.cursor()
crsr.execute("CREATE TABLE list (id INTEGER PRIMARY KEY, name TEXT);")
crsr.execute("INSERT INTO list VALUES(1, 'value1');")
The program runs fine with no errors. When I open the database in DB browser, I see that the table list has been successfully created with the columns I specified. But when I actually view the SQL data, no values are in the table.
Clearly, I am successfully connecting to DB Browser since I'm able to make a table- but why is my data not inserting into it?
connection.commit()after your INSERT statement.