简体   繁体   English

如何在python中从peewee调用mysql程序

[英]how to call a mysql procedure from peewee in python

How to call a mysql procedure of peewee in python.如何在python中调用peewee的mysql程序。

I need examples?我需要例子吗?

You can obtain a reference to a cursor by doing:您可以通过执行以下操作获取对游标的引用:

cursor = db.cursor()
cursor.callproc(...)

I'm not sure if this will work, too, but if you can use regular function syntax, then you can do fn.ADD_EXTERNAL_CONTACT_INFO(...) using the fn helper.我不确定这是否也行得通,但是如果您可以使用常规函数语法,那么您可以使用fn助手执行fn.ADD_EXTERNAL_CONTACT_INFO(...)

例子:

database.execute_sql('call sentence(%s, %s)',(parameter1,parameter2))  

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM