File size: 531 Bytes
e607550
5498558
 
 
 
e607550
5498558
 
 
e607550
5498558
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

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