CData Python Connector for SAP SuccessFactors

Build 20.0.7745

Updating Data

The connection's cursor object is used to issue INSERT, UPDATE, and DELETE commands to the data source. If desired, parameters are used with these statements. Unlike many python connectors, this connector does not support transactions. Consequently, any SQL statements executed by this connector affect the data source immediately. So, the commit() method on the connection object should not be used.

Insert

The following example adds a new record to the table:

import cdata.sapsuccessfactors as mod
conn = mod.connect("User=username;Password=password;CompanyId=CompanyId;Url=https://api4.successfactors.com")
cur = conn.cursor()
cmd = "INSERT INTO SampleTable_1 (Id, Column1) VALUES (?, ?)"
params = ["Jon Doe", "John"]
cur.execute(cmd, params)
print("Records affected: ", cur.rowcount)

Update

The following example modifies an existing record in the table:

import cdata.sapsuccessfactors as mod
conn = mod.connect("User=username;Password=password;CompanyId=CompanyId;Url=https://api4.successfactors.com")
cur = conn.cursor()
cmd = "UPDATE SampleTable_1 SET Column1 = ? WHERE Id = ?"
params = ["John", "6"]
cur.execute(cmd, params)
print("Records affected: ", cur.rowcount)

Delete

The following example removes an existing record from the table:

import cdata.sapsuccessfactors as mod
conn = mod.connect("User=username;Password=password;CompanyId=CompanyId;Url=https://api4.successfactors.com")
cur = conn.cursor()
cmd = "DELETE FROM SampleTable_1 WHERE Id = ?"
params = ["6"]
cur.execute(cmd, params)
print("Records affected: ", cur.rowcount)

Copyright (c) 2021 CData Software, Inc. - All rights reserved.
Build 20.0.7745