CData Python Connector for Office 365 2019 - Online Help
Questions / Feedback?

Calling Stored Procedures

CData Python Connector for Office 365 2019 - Build 19.0.7416

You can execute stored procedures using either the execute() or callproc() method of the cursor object.

Call Stored Procedures Using the Execute Method

Stored procedures are called by issuing EXECUTE commands. The stored procedures parameters are parameterized, as in the following example:

import cdata.office365 as mod
conn = mod.connect("InitiateOAuth=GETANDREFRESH;OAuthClientId=MyApplicationId;OAuthClientSecret=MySecretKey;CallbackURL=http://localhost:33333;")
cur = conn.cursor()
cmd = "EXECUTE SendMail MessageId = ?"
params = ("abc123", )
cur.execute(cmd, params)
rs = cur.fetchall()
for row in rs:
	print(row)

Call Stored Procedures Using the Callproc Method

Rather than using "execute()", one can also use the callproc() method to execute the procedure. The method takes a procedure name and a list of parameters as its arguments:

import cdata.office365 as mod
conn = mod.connect("InitiateOAuth=GETANDREFRESH;OAuthClientId=MyApplicationId;OAuthClientSecret=MySecretKey;CallbackURL=http://localhost:33333;")
cur = conn.cursor()
params = ("abc123", )
cur.callproc("SendMail", params)
rs = cur.fetchall()
for row in rs:
	print(row)

 
 
Copyright (c) 2020 CData Software, Inc. - All rights reserved.
Build 19.0.7416.0