|
Python Connector for Salesforce Using the module - Python Connector for Salesforce |
|
To retrieve data from Salesforce:
import devart.salesforce as salesforce
connect() module method and obtain a connection object:
my_connection = salesforce.connect(
Authentication="Basic",
Host="your_org_url",
UserId="your_username",
UserPassword="your_password",
SecurityToken="your_token"
)
response = salesforce.signin(Host="your_org_url")
my_connection = salesforce.connect(
Authentication="OAuth",
Host="your_org_url",
RefreshToken=response["Refresh Token"]
)
cursor object using the cursor() connection method.
my_cursor = my_connection.cursor()
execute() cursor method.
my_cursor.execute("SELECT * FROM employees")
fetch*() cursor methods.
for row in my_cursor.fetchall():
print(row)