mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
move update code for postcode and word count to Python
Adds also tests for the new function to execute a SQL script.
This commit is contained in:
11
nominatim/db/utils.py
Normal file
11
nominatim/db/utils.py
Normal file
@@ -0,0 +1,11 @@
|
||||
"""
|
||||
Helper functions for handling DB accesses.
|
||||
"""
|
||||
|
||||
def execute_file(conn, fname):
|
||||
""" Read an SQL file and run its contents against the given connection.
|
||||
"""
|
||||
with fname.open('r') as fdesc:
|
||||
sql = fdesc.read()
|
||||
with conn.cursor() as cur:
|
||||
cur.execute(sql)
|
||||
Reference in New Issue
Block a user