I have the below code , and i want to return of my fetch_data_from_db as a dictionary, Currently it is returning a tuple. please let me know what code should be added to the existing to get the same ?
import cx_Oracle
class OracleDBConnection(object):
def connect_oracle_db(self,connectionstring):
con=None
try:
con = cx_Oracle.connect(connectionstring)
return con
except Exception as e:
print str(e.args)
print str(e)
return str(e)
#print con.version
def fetch_data_from_db(self,con, query):
curs = con.cursor()
curs.execute(query)
res=curs.fetchall()
return res