Reputation: 28090
I have this simple python sqlite code to execute a simple SQL statement.
import sqlite3
db_pathname = "./data/db.sqlite3"
sqlite_conn = sqlite3.connect(db_pathname)
sqlite_cur = sqlite_conn.cursor()
sql_statement = """INSERT OR REPLACE INTO table_infos (code, name) VALUES('XL2.SO', 'AGOS Pte')"""
sqlite_cur.execute(sql_statement)
I do not see a new record being added to the sqlite database after running the code. However, if I run the SQL statement manually using a sqlite tool called DB Browser, a new record is added.
I am using python 3.6 and sqlite3.
Upvotes: 0
Views: 80
Reputation: 599926
You need to commit the changes.
sqlite_cur.execute(sql_statement)
sqlite_conn.commit()
Upvotes: 3