]> git.openstreetmap.org Git - nominatim.git/blob - nominatim/db/utils.py
Merge pull request #2155 from lonvia/port-regresh-to-python
[nominatim.git] / nominatim / db / utils.py
1 """
2 Helper functions for handling DB accesses.
3 """
4
5 def execute_file(conn, fname):
6     """ Read an SQL file and run its contents against the given connection.
7     """
8     with fname.open('r') as fdesc:
9         sql = fdesc.read()
10     with conn.cursor() as cur:
11         cur.execute(sql)
12     conn.commit()