我有一个存储过程:
CREATE PROCEDURE get_options_for_date(IN ticker_arg varchar(10), in maturity_arg varchar(20))
BEGIN
select dt,ticker,maturity,strike,bid,ask,last,callPut,symbol from bats.yahooOpt where (delta is null) and ticker=ticker_arg and (dt =maturity_arg ) ;
END//
DELIMITER ;
我这样测试:
call get_options_for_date("IBM","20141224")
在mysql用户界面,这是完美的工作!你知道吗
但是当我使用sqlalchemy(http://docs.sqlalchemy.org/en/latest/core/connections.html#calling-stored-procedures)从python调用它时:
def get_option_combos(dt,ticker):
db = get_engine(True)
dts={}
connection = db.raw_connection()
print (ticker, dt)
cursor = connection.cursor()
cursor.callproc('get_options_for_date', [ticker, dt])
result = cursor.fetchall()
cursor.close()
for row in result:
dts[str(row[len(row)-1])]=row
return dts
我的结果总是空的,但在UI中不是这样。你知道吗
有什么线索吗?你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐