from typing import Optional
from pathlib import Path
-from psycopg2 import sql as pysql
+from psycopg import sql as pysql
-from nominatim_core.db.connection import Connection
+from ..db.connection import Connection, drop_tables, table_exists
UPDATE_TABLES = [
'address_levels',
+ pysql.SQL(' or ').join(parts))
tables = [r[0] for r in cur]
- for table in tables:
- cur.drop_table(table, cascade=True)
-
+ drop_tables(conn, *tables, cascade=True)
conn.commit()
""" Returns true if database is in a frozen state
"""
- return conn.table_exists('place') is False
+ return table_exists(conn, 'place') is False