1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 |
import cx_Oracle
def makedict(cursor):
"""Convert cx_oracle query result to be a dictionary
"""
cols = [d[0] for d in cursor.description]
def createrow(*args):
return dict(zip(cols, args))
return createrow
db = cx_Oracle.connect('user', 'pw', 'host')
cursor = db.cursor()
rs = cursor.execute('SELECT * FROM Tablename')
cursor.rowfactory = makedict(cursor) |
cs |
'생산성 향상 > Python' 카테고리의 다른 글
[Python]Oracle 접속 (0) | 2017.07.07 |
---|