Browse Source

Update db_export.py

master
kjg 2 years ago
parent
commit
ab1ecc3ca5
  1. 22
      db_export.py

22
db_export.py

@ -6,28 +6,11 @@ db_user = config['db']['db_user']
db_password = config['db']['db_password']
db_port = config['db']['db_port']
#with open("list") as data:
# lines = data.readlines()
#numbers=[]
#for line in lines:
# numbers.append(line.split())
#conn = pg2.connect("host = localhost dbname={} user={} password={} port={}".format(db_name,db_user,db_password,db_port))
#conn.autocommit = True
#cur = conn.cursor()
def setconn(u_id, vm_num, vm_port,vm_host):
conn = pg2.connect("host = localhost dbname={} user={} password={} port={}".format(db_name,db_user,db_password,db_port))
conn.autocommit = True
cur = conn.cursor()
#for con in numbers:
#u_id = con[0]
#vm_num = con[1]
#vm_port = con[2]
#vm_host = con[3]
cur.execute("SELECT entity_id FROM guacamole_entity WHERE name = '{}'".format(u_id))
row = cur.fetchone()
if row == None:
@ -69,7 +52,4 @@ def setconn(u_id, vm_num, vm_port,vm_host):
#cur.execute("UPDATE guacamole_connection_parameter SET parameter_value='UTF-8' where connection_id='{}' and parameter_name='clipboard-encoding'".format(cn_id))
print("no connection")
conn.close()
return None
#print("test")
#conn.close()
return None
Loading…
Cancel
Save