2 Functions for removing unnecessary data from the database.
4 from pathlib import Path
20 def drop_update_tables(conn):
21 """ Drop all tables only necessary for updating the database from
25 where = ' or '.join(["(tablename LIKE '{}')".format(t) for t in UPDATE_TABLES])
27 with conn.cursor() as cur:
28 cur.execute("SELECT tablename FROM pg_tables WHERE " + where)
29 tables = [r[0] for r in cur]
32 cur.execute('DROP TABLE IF EXISTS "{}" CASCADE'.format(table))
37 def drop_flatnode_file(fname):
38 """ Remove the flatnode file if it exists.