I am trying to data extraction from salesforce using APIs and python. I am using simple salesforce library. Below is my code:
from simple_salesforce import Salesforce
sf = Salesforce(username=username_slsfrc, password=password_slsfrc, consumer_key=consumer_key, consumer_secret=consumer_sct, domain = 'test', proxies = proxies)
extract = sf.query_all(queryString)
data = pd.DataFrame(extract ['records']).drop(columns='attributes')
But I keep getting the following error: Error Code 414. Response content: <h1>Bad Message 414</h1><pre>reason: URI Too Long</pre> error
Can someone please help me this error?
SOQL queries have to be at most 100K characters. With up to 800 custom fields on most objects and 40 characters max length (more if you add all the __c
and maybe namespace prefixes) yes, it's possible you will hit this limit.
It's hard to say more without seeing your query, maybe there are things we can optimise in the WHERE clause for example.
If it's really dying on too many fields - split your query into 2 jobs and patch it together somehow afterwards using Id as unique.