Saleforce Simple Salesforce Python和Pandas-如何将记录转换为数据框以放入表中

问题描述

我已经从Salesforce API中检索了所需的数据:

SELECT AccEmail__c,(select custid__c from Backends__r)
from Account 
where Id in (select account__c from Backend__c where custid__c LIKE '%CUST%')

这将为我返回记录的有序字典,例如:

Out[22]: {'records': [OrderedDict([('attributes',OrderedDict([('type','Account'),('url','/services/data/')])),('AccEmail__c','email.com'),('Backends__r',OrderedDict([('totalSize',1),('done',True),('records',[OrderedDict([('attributes','Backend__c'),('custid__c','CUST209522')])])]))]),

然后我将其转换为数据框:

a_query= pd.DataFrame(sf.query_all("SELECT AccEmail__c,(select custid__c from Backends__r where custid__c LIKE '%CUST%') from Account where Id in (select account__c from Backend__c where custid__c LIKE '%CUST%')")['records']).drop(columns=['attributes'])

这会删除属性”列,但在Backends__r内仍然存在所有其他属性

如何删除文件,而只将AccEmail__c和custid__c存储在表中?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)