我有一个小班,可以帮助我提取 salesforceobject 数据框和列。我对 simple_salesforce 包中的 SFType 有疑问。我正在尝试从某个 Salesforce 对象的数据框中检索列标题。这是我的课程的一个片段:from simple_salesforce import Salesforcefrom simple_salesforce import SFTypeimport pandas as pdimport numpy as npclass SfData: def __init__(self,user,pw,token,obj): self.user = user self.pw = pw self.token = token self.sf = Salesforce(username = self.user,password = self.pw, security_token=self.token) self.obj = obj def retrieve_columns(self): df = SFType(self.obj, self.sf.session_id, self.sf.sf_instance) col_names = [x['name'] for x in self.sf.df.describe()['fields']] return col_names调用该类后,调用该方法时出现以下错误:test.SfData(myuser,mypw,mytoken,"Account")test.retrieve_columns()Resource df Not Found. Response content: [{'errorCode': 'NOT_FOUND', 'message': 'The requested resource does not exist'}]
1 回答
MM们
TA贡献1886条经验 获得超2个赞
我不需要使用我的凭据来调用方法“describe”,而是:
df = SFType(self.obj, self.sf.session_id, self.sf.sf_instance)
data = df.describe()
columns = [x['name'] for x in data['fields']]
return columns
添加回答
举报
0/150
提交
取消