2024-10-04 01:32:35 发布
网友
我有一个表,其中的数据如下所示
Name Query RunDate SP Some_sp 12/25/2017 Sp1 Some1_sp 12/25/2017 sp_2 Some2_sp 12/25/2107
查询列具有要执行的存储过程。在
我正在查询该表并将其保存为pandas dateframe。下一步是逐个执行查询列中的存储过程。有没有一种方法可以使用pypyodbc实现这一点?在
试试这个:
def getDatafromDB(self): sql = """Select Query from table""" self.cursor.execute(sql) data=self.cursor.fetchall() while data: print(data) if self.cursor.nextset(): sql = "{call "+data+"(?)}" params = (3,) cursor = connection.cursor() rows = cursor.execute(sql, params).fetchall() print(rows) else: data= None
试试这个:
相关问题 更多 >
编程相关推荐