I'm using psycopg2 on windows7 and python3.4.4.
I'd like to get data from tables of uppercase name, but I couldn't figure it out. Can anyone help me?
Always retuturn like this
relation "table" does not exist
I want to make "table" uppercase.
here's my code import psycopg2
class KindOfCoupons:
def get_coupons(self, cur, names):
coupons = {}
for name in names:
coupons[name] = cur.execute("SELECT * FROM \"" + name + "\" ;")
return coupons
def connect_redshift(self):
conn = psycopg2.connect("dbname=dbname host=host user=user password=password port=000")
return conn.cursor()
def get_coupon_used_type(self):
cur = self.connect_redshift()
names = ["TABLE", "TABLE_B", "TABLE_C"]
coupons = self.get_coupons(cur, names)
coupons[names[0]][0]