所以我有一个存储过程,我想连接到它并在 python 中执行,这样我就可以将数据导出为一个花哨的表。这是我使用的代码,注释是我尝试过的代码。import plotly as pyimport plotly.figure_factory as ffimport pandas as pdimport pypyodbcimport pyodbcimport datetimeimport seaborn as snsimport matplotlib.pyplot as plt#force the ODBC driver to use case-sensitive column namespypyodbc.lowercase = True startdate = '2018-10-23 08:00'enddate = '2018-10-24 12:00'params = startdate,enddate##Establishing a connection to SQL databaseconnection = pypyodbc.connect('Driver={SQL Server};' 'Server=LOLOL;' 'Database=LOL_Collection;' 'trusted_connection=yes;')crsr = connection.cursor()SQL = """SET NOCOUNT ONdeclare @start = '2018-10-23 08:00'declare @end = '2018-10-24 12:00'exec [dbo].[AM_SIGNAL_Histogram] @start, @end"""#SQL = """# #exec [dbo].[AM_SIGNAL_Histogram] @start, @end##"""#result = crsr.execute(SQL)# #print(result.fetchall())df = pd.read_sql(SQL,connection)connection.close()这是我不断收到的错误:ProgrammingError: ('42000', "[42000] [Microsoft][ODBC SQL Server 驱动程序][SQL Server]'='附近的语法不正确。")感谢您的帮助,肯尼斯
添加回答
举报
0/150
提交
取消