Extending Simple Salesforce to support Pandas exports and more.
Project description
simpler-sf
Extending the low-level Salesforce API client Simple Salesforce to support exports in Pandas, and other features.
Usage
Install
pip install simpler-sf
Import
import simpler_sf
simpler_sf.simple_salesforce()
import simple_salesforce
# That's it!
Query
Simpler-sf adds the smart_query()
method to the simple_salesforce.Salesforce
class.
The advantages over the existing methods are:
- Un-nesting of results for relationship queries (aka the infamous
'attributes'
field) (not just for one level) - Query results in
pd.Dataframe
format - No limit on the number of output rows as in
simple_salesforce.Salesforce.query()
and at the same time... - No need to use a different class for each Salesforce object as in
sf.bulk.Account.query(query)
- The option to filter dynamically, on large amounts of values without a limit on the number of characters
Example
sf = simple_salesforce.Salesforce(username=username, password=password, security_token=token)
df = sf.smart_query('SELECT Contact.Id, Contact.FirstName, Account.Name, Campaign FROM CampaignMember')
print(df)
Output:
Contact.Id Contact.FirstName Account.Name Campaign
0 0032400000QZbmtAAD Emily Amazon CampaignA_2023Q2
1 0032400000eGqdZAAS Jasmine Amazon CampaignA_2023Q2
2 00324036u9QZbnGAAT Míng Microsoft CampaignB_2022Q4
3 0032400000QZbygAAX Magdalena Google CampaignC_2023Q1
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
simpler_sf-1.0.2.tar.gz
(4.6 kB
view hashes)
Built Distribution
Close
Hashes for simpler_sf-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d9abf13de5389b97b266794a1eed3131d2936e010b749580d209b297cc0c2f1 |
|
MD5 | e7071be9e34eb5ddb9c28a0a0b53a551 |
|
BLAKE2b-256 | c2d0286b2825a70a0486ce0a7f1ae38942c4fac1864db7664a5738e43c8cf943 |