mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-02-27 05:28:23 +00:00
Comments
This commit is contained in:
parent
e6873e0ebd
commit
ae9b5bdffc
1 changed files with 5 additions and 1 deletions
|
@ -43,16 +43,20 @@
|
|||
|
||||
import sqlite3
|
||||
|
||||
# Logfile containing unique list of all domains on downloaded lists.
|
||||
logfile = '/etc/pihole/pihole.2.eventHorizon.txt'
|
||||
|
||||
# Create the SQLite connection
|
||||
conn = sqlite3.connect('/etc/pihole/pihole.db')
|
||||
|
||||
# Python auto-handle commits, no need to call for commits manually
|
||||
with conn:
|
||||
c = conn.cursor()
|
||||
|
||||
# Lists have just been downloaded, clear out the existing data
|
||||
c.execute('DROP TABLE IF EXISTS gravity')
|
||||
|
||||
# Ready new table for list of domains
|
||||
qt = '''
|
||||
CREATE TABLE IF NOT EXISTS gravity (
|
||||
idx INTEGER PRIMARY KEY ASC,
|
||||
|
@ -64,7 +68,7 @@ with conn:
|
|||
# enable WAL mode
|
||||
c.execute('PRAGMA journal_mode=WAL;')
|
||||
|
||||
# Parse the log file.
|
||||
# Parse the log file into the database
|
||||
with open(logfile) as f:
|
||||
for line in f:
|
||||
sql = "INSERT INTO gravity (domain) VALUES (?)"
|
||||
|
|
Loading…
Add table
Reference in a new issue