python调用存储过程怎么传多个参数_pymysql如何传递存储过程的参数

我尝试使用csv作为数据源,并从mysql数据库调用一个存储过程来填充数据库。我当前正在获取异常:发生异常:(1318,“过程的参数数目不正确。”mydb.update_服务器;应为3,得到0')import pymysql

#import myconnutils

import datetime

import xlrd

import re

import os

import csv

#open csv file

with open('DBstatus.csv') as csvfile:

reader = csv.DictReader(csvfile)

for row in reader:

print(row['Host Name'], row["OS Type"], row['Host Description'])

#create database connection

databaseConnection = pymysql.connect(host='localhost', user='xxx', password='xxx', db='mydb', cursorclass= pymysql.cursors.DictCursor)

try:

cursorObject = databaseConnection.cursor()

# parms = (row['Host Name'], row["OS Type"], row['Host Description'])

# resultArgs = cursor.callproc('update_servers', inOutParams)

cursorObject.execute("call update_servers")

for result in cursorObject.fetchall():

print(result)

except Exception as e:

print("exception occured: {}".format (e))

finally:

databaseConnection.close()

存储过程:

^{pr2}$

你可能感兴趣的:(python调用存储过程怎么传多个参数_pymysql如何传递存储过程的参数)