【问题标题】:How to call postgresql stored procedure using sqlalchemy?如何使用 sqlalchemy 调用 postgresql 存储过程?
【发布时间】:2020-01-24 10:44:37
【问题描述】:

我在 postgresql 中开发了存储过程,它接受 2 个参数,我使用 sqlalchemy 使用下面的代码调用它,但出现语法错误。

我已经尝试过 sqlalchemy 在线教程。

connection.execute('stored_proce_name ?, ?',  para_1, para_2 )                                        

在“stored_proce_name”或附近出现类似:ProgrammingError('(psycopg2.errors.SyntaxError) 语法错误\nLINE 1: stored_proce_name ?, ?\n ^\n') 的错误

【问题讨论】:

    标签: python django postgresql sqlalchemy


    【解决方案1】:

    我是这样做的:

    result = conn.execute(StoredProc("add", (3, 4), Integer))
    

    【讨论】:

    • 这里的整数是什么意思?
    • 指的是返回类型
    • 嗨@Moon,如果我的回答对你有用,请考虑投票和/或选择它作为最终答案。谢谢!
    • 嗨,StoredProcedure 类是从哪里来的?
    猜你喜欢
    • 2013-06-15
    • 2016-01-23
    • 2014-11-24
    • 2021-09-02
    • 2018-01-10
    • 1970-01-01
    • 2021-08-13
    • 1970-01-01
    • 2011-04-03
    相关资源
    最近更新 更多