Akash Xavier RSS


About

Everything interesting that I come across in my life, I post it here.

Social
Feb
8th
Sun
permalink

Auto-Commit mode in Python-SQLite

I executed all the insert statements for SQLite in Python and was wondering why my database was empty when I queried it. This I did from my Python script.

I was scratching my head as to what’s wrong and then found out that the isolation_level must be set to None while connecting to the database like below

from pysqlite2 import dbapi2 as sqlite
connection = sqlite.connect(‘jaxfu.db’,isolation_level=None)
cursor = connection.cursor()
bla bla bla… here goes your code… :)

Now it should work fine!