2 Query and access functions for the in-database property table.
5 def set_property(conn, name, value):
6 """ Add or replace the propery with the given name.
8 with conn.cursor() as cur:
9 cur.execute('SELECT value FROM nominatim_properties WHERE property = %s',
13 sql = 'INSERT INTO nominatim_properties (value, property) VALUES (%s, %s)'
15 sql = 'UPDATE nominatim_properties SET value = %s WHERE property = %s'
17 cur.execute(sql, (value, name))
20 def get_property(conn, name):
21 """ Return the current value of the given propery or None if the property
24 with conn.cursor() as cur:
25 cur.execute('SELECT value FROM nominatim_properties WHERE property = %s',
28 return cur.fetchone()[0] if cur.rowcount > 0 else None