]> git.ipfire.org Git - location/location-database.git/commitdiff
tools: Commit to database only once when importing data
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 17 Jun 2018 20:27:09 +0000 (21:27 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 17 Jun 2018 20:27:27 +0000 (21:27 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
tools/base.py

index d6af1326f6151e822db5212c4c924cc00005d78c..441ccebd706d9482527a9e14cf5bc6bbde0cad57 100644 (file)
@@ -98,9 +98,6 @@ class RIRParser(object):
        def _make_database(self, **kwargs):
                db = psycopg2.connect(**kwargs)
 
-               # Enable autocommit
-               #db.autocommit = True
-
                # Create database layout
                with db.cursor() as cursor:
                        # Autnums
@@ -212,7 +209,7 @@ class RIRParser(object):
                for url in self.rir.database_urls:
                        self.parse_url(url)
 
-                       self.db.commit()
+               self.db.commit()
 
        def parse_url(self, url):
                with self.downloader.request(url) as r: