July 4th, 2013, 04:34 AM
Join Date: Feb 2013
Time spent in forums: 2 h 44 m 4 sec
Reputation Power: 0
Python & sqlite3 Insert woes
I'm having a problem inserting a record into a sqlite3 table. The insert statement works fine if I execute it as pure SQL in sqlite at the CLI, but from Python it is causing me a headache!
My code is as such:
connection = sqlite3.connect(SQL_FILE)
cur = connection.cursor()
cur.execute("INSERT INTO outofmemoryexception (oom_id, oom_date, oom_time) VALUES(8, '2013-07-03', '16:12:45')")
Like I said, if I execute: INSERT INTO outofmemoryexception (oom_id, oom_date, oom_time) VALUES(8, '2013-07-03', '16:12:45')
as pure SQL it works, so I really don't understand what is happening?
I can access the database fine from within Python, I can select from the tables and get valid data back, but I don't quite understand why this is being such a pain?