1👍
✅
Update your sqlite3 library and you should be good. It looks like your version does not have support for converting datetime objects. You can test this by executing the following on the shell:
Python 2.7.5+ (default, Feb 27 2014, 19:37:08)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> import datetime
>>> db = sqlite3.connect('/tmp/sql.sqlite3')
>>> db.execute("""CREATE TABLE IF NOT EXISTS sessions (session integer
... primary key autoincrement, start timestamp,
... end timestamp, num_cmds integer, remark text)""")
>>> db.commit()
>>> cur = db.execute("""INSERT INTO sessions VALUES (NULL, ?, NULL,NULL, "") """, (datetime.datetime.now(),))
>>> cur.fetchall()
[]
>>> db.execute("""SELECT * FROM sessions""").fetchall()
[(1, u'2015-02-25 22:07:00.284058', None, None, u'')]
pip install -U sqlite3
This is what worked for me:
Python 2.7.5+ (default, Feb 27 2014, 19:37:08)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.7.17'
>>> sqlite3.version
'2.6.0'
Source:stackexchange.com