Esempio n. 1
0
    def __init__(self, config):
        Connector.__init__(self, config)

        token = salesforce.get_json(self.config.get("token"))
        try:
            salesforce.API_BASE_URL = token.get('instance_url')
            salesforce.ACCESS_TOKEN = token.get('access_token')
        except Exception as e:
            raise ValueError(
                "JSON token must contain access_token and instance_url")

        self.RESULT_FORMAT = self.config.get("result_format")
Esempio n. 2
0
# Note about typing:
# The configuration of the recipe is passed through a JSON object
# As such, INT parameters of the recipe are received in the get_recipe_config() dict as a Python float.
# If you absolutely require a Python int, use int(get_recipe_config()["my_int_param"])

#############################
# Your original recipe
#############################

#FILE_TOKEN=dataiku.get_custom_variables()['dip.home']+'/salesforce/sales_cloud_token.json'
FILE_TOKEN = get_recipe_config()['token']
COLUMNS = get_recipe_config()['COLUMNS']
OBJECT = get_recipe_config()['SF_OBJECT']

token = salesforce.get_json(FILE_TOKEN)
ACCESS_TOKEN = token.get("access_token")
API_BASE_URL = token.get("instance_url")
s = requests.Session()

# Recipe inputs

for c in df:
    if df[c].dtype == 'datetime64[ns]':
        df[c] = df[c].apply(lambda x: x.strftime('%Y-%m-%d'))

df['error'] = ''
df['data'] = ''
df['Id'] = ''

df = df[COLUMNS]