在 class 中不适用于 SFType 的方法
Method not working with SFType in a class
我有一个小的 class 可以帮助我提取 salesforceobject 数据框和列。 simple_salesforce 包中的 SFType 有问题。我正在尝试从某个销售人员 object 的数据框中检索列 headers。这是我的 class:
的片段
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
调用 class 方法后,我在调用该方法时遇到以下错误:
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
我有一个小的 class 可以帮助我提取 salesforceobject 数据框和列。 simple_salesforce 包中的 SFType 有问题。我正在尝试从某个销售人员 object 的数据框中检索列 headers。这是我的 class:
的片段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
调用 class 方法后,我在调用该方法时遇到以下错误:
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