From 52898b99912dde70b97e27743f0debe4572e5ff9 Mon Sep 17 00:00:00 2001 From: MMotti Date: Fri, 21 Feb 2020 00:18:55 +0000 Subject: [PATCH] Update new gravity_count field in the info table --- gravityOptimise.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gravityOptimise.py b/gravityOptimise.py index 827adc8..413b448 100644 --- a/gravityOptimise.py +++ b/gravityOptimise.py @@ -35,6 +35,7 @@ def split_list(in_list, size): list_removal_chunks = list() set_regexp_domain_matches = set() set_removal_domains = set() +count_db_gravity = None db_exists = False c = None @@ -258,7 +259,15 @@ def split_list(in_list, size): # Query actual DB count c.execute('SELECT COUNT(DISTINCT domain) FROM gravity') - print(f'[i] --> {c.fetchall()[0][0]:n} domains remain in the gravity database') + count_db_gravity = c.fetchall()[0][0] + print(f'[i] --> {count_db_gravity:n} domains remain in the gravity database') + + # Update gravity_count in info table + print('[i] Updating the gravity count in the info table') + c.execute('INSERT OR REPLACE INTO info (property, value) VALUES (?, ?)', ('gravity_count', count_db_gravity)) + + # Commit Changes + conn.commit() conn.close() else: