gpt4 book ai didi

python - 如何使用sqlalchemy调用postgresql存储过程?

转载 作者:行者123 更新时间:2023-11-29 11:34:45 25 4
gpt4 key购买 nike

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

我试过 sqlalchemy 在线教程。

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

出现类似 :ProgrammingError('(psycopg2.errors.SyntaxError) syntax error at or near "stored_proce_name "\nLINE 1: stored_proce_name ?, ?\n ^\n')

最佳答案

这是我的做法:

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

关于python - 如何使用sqlalchemy调用postgresql存储过程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58078092/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com