Reputation: 3
I am trying to export the data from salesforce using python and simple salesforce, but when I try to export the data into the CSV File I get only 200 records. Here is my code:
import pandas as pd
from simple_salesforce import Salesforce
import csv
data=Salesforce(password='*********',username='***********',organizationId='***')
results=pd.DataFrame(data.query("SELECT AccountId,
Email_To__c,EM_Escalation_Comment__c,EM_Escalation_status__c,End_Customer__c,Engineering_Action_Required__c,Engineering_Action__c,Engineering_Status__c,EntitlementId,Entitlement_check__c,EPS_Case_Tracking_ID__c,EPS_Reference__c,Error_Code__c,Escalation_Notes__c,Escalation_Status__c,Escalation_Validation__c,Event_ID__c,External_Ticket_Number__c,Handle_Time_Hours__c,Has_Article__c,Has_this_case_reopened__c,Id,Internal_Status__c,In_DBA_H FROM Case")['records'])
df=pd.DataFrame(results)
df.to_csv('/Users/apple/Desktop/CSV-Py/Case.csv')
Upvotes: 0
Views: 428
Reputation: 5757
If the result is extremely large then query will not retrieve all the results.
Use query_all
instead.
https://pypi.org/project/simple-salesforce/
Upvotes: 1