Move PRAGMA command to first step after cursor creation.

This commit is contained in:
Dan Schaper 2016-10-02 09:53:43 -07:00
parent e9ff14daf3
commit 9f94570fff

View file

@ -24,6 +24,9 @@ conn = sqlite3.connect('/etc/pihole/gravity.db')
with conn: with conn:
c = conn.cursor() c = conn.cursor()
# enable WAL mode
c.execute('PRAGMA journal_mode=WAL;')
# Lists have just been downloaded, clear out the existing data # Lists have just been downloaded, clear out the existing data
c.execute('DROP TABLE IF EXISTS gravity') c.execute('DROP TABLE IF EXISTS gravity')
@ -36,9 +39,6 @@ with conn:
''' '''
c.execute(gt) c.execute(gt)
# enable WAL mode
c.execute('PRAGMA journal_mode=WAL;')
# Parse the log file into the database # Parse the log file into the database
with open(logfile) as f: with open(logfile) as f:
for line in f: for line in f: