parent-child relationship query in simple_salesforce python, extracting from ordered dicts

后端 未结 2 1528
后悔当初
后悔当初 2021-01-05 18:11

I\'m trying to query information from salesforce using the simple_salesforce package in python.

The problem is that it\'s nesting fields that are a par

2条回答
  •  佛祖请我去吃肉
    2021-01-05 18:24

    Pandas can read ordered dicts.

    import pandas as pd
    from simple_salesforce import Salesforce
    
    sf = Salesforce(username='your_username',   
                    password='your_password',
                    security_token='your_token')
    
    query = "select id, account.id from opportunity where closedate = last_n_days:5"
    df = pd.DataFrame(sf.query_all(query)['records']).drop(columns='attributes')
    

提交回复
热议问题