salesforce_integration / modules /salesforce_connector.py python Copy Edit
Sanjayraju30's picture
Update modules/salesforce_connector.py python Copy Edit
e607550 verified
raw
history blame
531 Bytes
from simple_salesforce import Salesforce
import pandas as pd
def connect_salesforce(username, password, token, domain="login"):
return Salesforce(username=username, password=password, security_token=token, domain=domain)
def fetch_pole_data(sf):
query = """
SELECT Name, Solar_Generation__c, Wind_Generation__c, Tilt__c, Vibration__c, Camera_Status__c
FROM Smart_Pole__c
LIMIT 50
"""
records = sf.query_all(query)['records']
df = pd.DataFrame(records).drop(columns=['attributes'])
return df