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)
cursor = connection.cursor()
query = "SELECT * from jobs"
cursor.execute(query)
print(cursor.fectchall())
query = "DELETE from jobs"
cursor.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?
conn.execute()toss in aconn.commit()to commit your changes.conn(connection) is not helpful for understanding. In which case I think @bernie 's answer is actuallyconnection.commit()because you're using non-standard naming?conn = sqlite3.connect(something.db)andc = connection.cursor()