【发布时间】:2017-12-29 21:51:07
【问题描述】:
我有一个表格,其中的数据如下所示
Name Query RunDate
SP Some_sp 12/25/2017
Sp1 Some1_sp 12/25/2017
sp_2 Some2_sp 12/25/2107
查询列有要执行的存储过程。
def __init__(self):
self.conn=pypyodbc.connect(connection)
self.cursor=self.conn.cursor()
def getDatafromDB(self):
sql = """Select * from table"""
self.cursor.execute(sql)
data=pd.DataFrame(self.cursor.fetchall())
return data
我正在查询该表并将其保存为 pandas dateframe 。下一步是让我一个接一个地执行查询列中存在的那些存储过程。有没有办法使用 pypyodbc 做到这一点?
【问题讨论】:
标签: python sql pandas pypyodbc