【发布时间】:2018-02-28 01:42:56
【问题描述】:
在 python 中通过 psycopg2 调用我的 postgres 存储过程后,我试图获取列名列表...
这是我的代码
# create a connection to the database
conn = psycopg2.connect(...)
# create a cursor object for execution
curs = conn.cursor()
curs.callproc('usp_my_stored_proc', ['mySP'])
# now open a new cursor & "steal" the recordset from the previous cursor
curs2 = conn.cursor('mySP')
# close cursor & connection
curs2.close()
curs.close()
conn.close()
现在我想打印出存储过程的列,并将它们作为我的 CSV 文件的标题 - 我已经搜索过,但没有找到任何线索...
绝对欢迎建议/帮助...
【问题讨论】:
标签: python python-3.x postgresql cursor psycopg2