Django Call Stored Procedure on Second Database

故事扮演 提交于 2019-12-06 08:52:03
cyram

These are the following steps that I took:

  1. Made my stored procedure dump results into a temporary table so as to flatten the result set to a single result set. This got rid of the need for multi=True
  2. In addition, I made sure the user at my IP address had access to call stored procedures in the database itself.
  3. Finally, I continued to research the callproc function. Eventually someone on another site suggested the following code, which worked:

    cur = connections["SomeDB"].cursor()
    cur.callproc("spGetLocationPath", [id, someval])
    res = next(cur.stored_results()).fetchall()
    cur.close()
    
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!