方法不能在类中使用SFType



我有一个小类可以帮助我提取salesforceobject数据帧和列。我对simple_salesforce包中的SFType有问题。我正试图从某个salesforce对象的数据帧中检索列标题。以下是我的课堂片段:

from simple_salesforce import Salesforce
from simple_salesforce import SFType
import pandas as pd
import numpy as np
class 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'}]

我不需要使用我的凭据来调用方法"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

相关内容

  • 没有找到相关文章

最新更新