lundi 25 juillet 2016

Python sqlite3 delete not doing anything

I am a noob about sqlite (but somewhat experienced as Pythonista), but I am deeply confused why this (Python 2.7, DBPATH is the path to the database)...

import sqlite3

connection = sqlite3.connect(DBPATH)
conn = connection.cursor()
query = "SELECT * from jobs"
conn.execute(query)
print(conn.fectchall)
query = "DELETE from jobs"
conn.execute(query)

...Outputs the contents of the table (thus the name of the table is right) without altering it. Could someone point out the obvious?

Aucun commentaire:

Enregistrer un commentaire