Greetings, by using the psycopg2 library of python, I can currently connect to a DB and retrieve such like this:
conn = psycopg2.connect("dbname='db1' user='postgres' host='xxxxxx' password='mypass'");
qr = conn.cursor()
qr.execute("SELECT avg(pavg) FROM mytable WHERE id =5")
Now beside the database named "db1", I have to query another database from another ip that contains the same table, append the queries, i.e.
conn1 = psycopg2.connect("dbname='mydb' user='postgres' host='xxxxxx' password='mypass'");
conn2 = psycopg2.connect("dbname='mydb' user='postgres' host='yyyyyy' password='mypass'");
qr1 = conn1.cursor()
qr1.execute("SELECT avg(pavg) FROM mytable WHERE id =5")
qr2 = conn1.cursor()
qr2.execute("SELECT avg(pavg) FROM mytable WHERE id =5")
How can I achieve this ?