Python sqlalchemy调用存储过程

2024-06-25 23:23:51 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图使用sqlalchemypython调用stored procedure。我的代码如下:

@database_connection_wrapper
def get_adv(connection):
    ''' get the adv using a stored proc from the database '''

    connection.callproc("GetAdvMedianTrailing30Days")
    results = list(connection.fetchall())
    print(results)

我得到以下错误: AttributeError: 'pyodbc.Connection' object has no attribute 'callproc'

我遵循了官方文件上的指示,但这并没有造成任何影响。在

我在python 3.5

有没有不同的方法来调用stored procedures?在


Tags: the代码getsqlalchemydefprocconnectionwrapper