本文整理汇总了Python中simple_salesforce.Salesforce.describe方法的典型用法代码示例。如果您正苦于以下问题:Python Salesforce.describe方法的具体用法?Python Salesforce.describe怎么用?Python Salesforce.describe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simple_salesforce.Salesforce
的用法示例。
在下文中一共展示了Salesforce.describe方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: refresh
# 需要导入模块: from simple_salesforce import Salesforce [as 别名]
# 或者: from simple_salesforce.Salesforce import describe [as 别名]
def refresh(self, force=False):
"""
Refreshes this token if the session has expired.
:param force: Refresh this token even if the session hasn't expired
"""
if force:
auth.refresh_token(self)
return Salesforce(instance_url=self.instance_url, session_id=self.access_token, sandbox=self.is_sandbox)
try:
connection = Salesforce(instance_url=self.instance_url, session_id=self.access_token, sandbox=self.is_sandbox)
connection.describe()
except (SalesforceExpiredSession, SalesforceGeneralError):
auth.refresh_token(self)
return Salesforce(instance_url=self.instance_url, session_id=self.access_token, sandbox=self.is_sandbox)
else:
return connection
示例2: returnsObject
# 需要导入模块: from simple_salesforce import Salesforce [as 别名]
# 或者: from simple_salesforce.Salesforce import describe [as 别名]
def returnsObject(self):
sf = Salesforce(instance_url=self.instance_url, session_id=self.session_id)
object_list = []
for x in sf.describe()['sobjects']:
l1 = {}
l1['name']=x['name']
l1['custom']=x['custom']
l1['label']=x['label']
object_list.append(l1)
return object_list
示例3: handler
# 需要导入模块: from simple_salesforce import Salesforce [as 别名]
# 或者: from simple_salesforce.Salesforce import describe [as 别名]
def handler(event, context):
log.debug("Received event {}".format(json.dumps(event)))
sf = Salesforce(instance_url=event["instance_url"], session_id=event["session_id"])
objs = sf.describe()["sobjects"]
objects = map(describe(sf),objs)
client = boto3.client("dynamodb")
client.batch_write_item(RequestItems={'sobs-metadata-dev':map((lambda obj: {'PutRequest':{'Item':obj}}),objects)})
return {}
示例4: Salesforce
# 需要导入模块: from simple_salesforce import Salesforce [as 别名]
# 或者: from simple_salesforce.Salesforce import describe [as 别名]
sf = Salesforce(username=salesforceusername, password=salesforcepassword, security_token=salesforcesecuritytoken)
# establish connection to local db
print ("Testing local MySQL DB connection")
try:
cnx = mysql.connector.connect(**config)
cursor = cnx.cursor(buffered=True)
print ("Connection successful")
except mysql.connector.Error as err:
print("MySQL db settings error: {}".format(err))
# silent test to verify connection to salesforce complete
print ("Testing Salesforce Instance connection")
try:
sf.describe()
print ("Connection successful")
except SalesforceError as err:
print("Salesforce connection error: {}".format(err))
# check if first run of script
print ("Checking to See if Default SF Object Table is available")
sfobjectcheck = "SHOW TABLES LIKE 'sfobject_sfobject'"
cursor.execute(sfobjectcheck)
result1 = cursor.fetchone()
if result1:
sfobjcheck = 1;
else:
sobjectablecreate = ("CREATE TABLE sfobject_sfobject (data_id int(11) NOT NULL AUTO_INCREMENT Primary Key, obj_name TEXT,obj_keyPrefix TEXT,obj_label TEXT,obj_createable TEXT,obj_custom TEXT,obj_customSetting TEXT,created_at DATETIME DEFAULT NULL,modified_at DATETIME DEFAULT NULL)")
cursor.execute(sobjectablecreate)
sfobjcheck = 0;
示例5: returnsObject
# 需要导入模块: from simple_salesforce import Salesforce [as 别名]
# 或者: from simple_salesforce.Salesforce import describe [as 别名]
def returnsObject(self):
sf = Salesforce(username=self.username, password=self.password, security_token=self.security_token)
l1 = [[x['name'],x['custom'],x['label']] for x in sf.describe()['sobjects']]
return l1
示例6: Salesforce
# 需要导入模块: from simple_salesforce import Salesforce [as 别名]
# 或者: from simple_salesforce.Salesforce import describe [as 别名]
from simple_salesforce import Salesforce
from pandas import DataFrame
from collections import defaultdict
## create database engine and open a connection
engine = databaseconfig.DB_ENGINE
conn = engine.connect()
## create a salesforce session
sf = Salesforce(username=SF_UID,
password=SF_PWD,
security_token=SF_TOKEN,
organizationId='00Di0000000hSDR')
ktc_tables = sf.describe()
ktc_tables = ktc_tables[u'sobjects']
table_names = []
for i in ktc_tables:
table_names.append(i[u'name'])
#the ones we want
desired_tables = ['Account', 'Contact', 'College_Persistence__c', 'Contact', 'Contact_Note__c', 'Enrollment__c']
all_tables = defaultdict()
for i in desired_tables:
print 'Retrieving fields for table %s from Salesforce.' % i
#this gets us the attributes of the table
this_table = sf.__getattr__(i).describe()