【发布时间】:2022-02-18 05:41:02
【问题描述】:
我想从 Python 连接到 Oracle 数据库数据。我用代码做到了:
import cx_Oracle
CONN_INFO = {
'host': 'xxx.xx.xxx.x',
'port': 12345,
'user': 'user_name',
'psw': 'my_password',
'service': 'abc.xyz.com',
}
CONN_STR = '{user}/{psw}@{host}:{port}/{service}'.format(**CONN_INFO)
connection = cx_Oracle.connect(CONN_STR)
c = connection.cursor()
rs = c.execute('select * from my_table')
df = pd.DataFrame(rs)
但是,我注意到所有标题都丢失了,取而代之的是 0, 1, 2, 3, ... This answer 建议更改 pagesize 但这会更改 Oracle 设置吗?我想避免在 Oracle DB 中进行任何更改。有没有办法解决这个问题?
【问题讨论】: