查询oralce数据库返回数据字典

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

    def sqlDiy(self, sql):
        db = Oradao().connect()
        cursor = db.cursor()
        cursor.execute(sql)
        result = cursor.fetchall()
        colum = {}
        rs = []
        for i in range(cursor.description.__len__()):
            for n in range(result.__len__()):
                try:
                    rs.append(result[n][i])
                except Exception as e:
                    print e
            colum[cursor.description[i][0]] = rs
            rs = []
        cursor.close
        db.close
        return colum