Debian Codegraph @

powa_collector/utils.py

raw
1 """
2 General functions shared between the main thread and the remote server threads.
3 """
4 def get_powa_version(conn):
5 """Get powa's extension version"""
6 cur = conn.cursor()
7 cur.execute("""SELECT
8 regexp_split_to_array(extversion, E'\\\\.'),
9 extversion
10 FROM pg_catalog.pg_extension
11 WHERE extname = 'powa'""")
12 res = cur.fetchone()
13 cur.close()
14
15 return res
16
17
18 def conf_are_equal(conf1, conf2):
19 """Compare two configurations, returns True if equal"""
20 for k in conf1.keys():
21 if (k not in conf2):
22 return False
23 if (conf1[k] != conf2[k]):
24 return False
25
26 for k in conf2.keys():
27 if (k not in conf1):
28 return False
29 if (conf1[k] != conf2[k]):
30 return False
31
32 return True