-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDB.py
34 lines (27 loc) · 793 Bytes
/
DB.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""."""
import psycopg2
class DB:
"""."""
def __init__(self):
"""."""
pass
def conection(self):
"""."""
p = 'ec295620870456a69cedc3a43ab9ffa244511e0033af2587df7f363d318e509c'
conn = \
psycopg2.connect(
user="xqcfpjqsanbhpa",
password=p,
host="ec2-107-22-239-155.compute-1.amazonaws.com",
port="5432",
database="d9755uu1fjnkn3")
return conn
def monta_retorno(self, colunas, valores):
"""."""
retorno = []
for i in range(len(valores)):
dict = {}
for j in range(len(colunas)):
dict[colunas[j][0]] = valores[i][j]
retorno.append(dict)
return retorno