]> git.openstreetmap.org Git - nominatim.git/commitdiff
Use place_exists() into can_compute() for postcodes
authorAntoJvlt <antonin.jolivat@gmail.com>
Tue, 8 Jun 2021 07:33:10 +0000 (09:33 +0200)
committerroot <root@gsoc2021-qa.nominatim.org>
Wed, 9 Jun 2021 07:31:32 +0000 (09:31 +0200)
nominatim/tools/postcodes.py

index fd35507901e1c6d123361c51263adac7c44fdab9..3ab59d59f8dcbee540bd5ed1e74eaf10e5cfdd46 100644 (file)
@@ -9,7 +9,7 @@ from math import isfinite
 
 from psycopg2.extras import execute_values
 
-from nominatim.db.connection import connect
+from nominatim.db.connection import _Connection, connect
 
 LOG = logging.getLogger()
 
@@ -203,9 +203,5 @@ def can_compute(dsn):
         Check that the place table exists so that
         postcodes can be computed.
     """
-    with connect(dsn) as conn:
-        with conn.cursor() as cur:
-            cur.execute("""
-                select exists(select 1 from information_schema.tables where table_name='place')
-            """)
-            return cur.fetchone()[0]
+    with _Connection(dsn) as conn:
+        return conn.table_exists('place')