1
0
Fork 0
gnuviechadmin-historic/backend/psycopgtest.py

32 lines
601 B
Python
Raw Normal View History

#!/usr/bin/env python
import psycopg
cnx = psycopg.connect("user=exim4 password=CotOgigmeIk5 dbname=gnuviechadmin")
cr = cnx.cursor()
print "-- Information from mailalias --"
cr.execute('SELECT * FROM mailalias')
cnx.commit()
print cr.description
result = cr.fetchall()
for line in result:
print line
print "-- Information from mailpasswd --"
cr.execute('SELECT * FROM mailpasswd')
cnx.commit()
result = cr.fetchall()
for line in result:
print line
print "-- Domains --"
cr.execute('SELECT DISTINCT domain FROM mailalias')
cnx.commit()
result = cr.fetchall()
for line in result:
print line