I've retrieved the data I need from the Salesforce API:
SELECT AccEmail__c,
(select custid__c from Backends__r)
from Account
where Id in (select account__c from Backend__c where custid__c LIKE '%CUST%')
This returns me an Ordered Dict of records like:
Out[22]: {'records': [OrderedDict([('attributes',
OrderedDict([('type', 'Account'),
('url',
'/services/data/')])),
('AccEmail__c', 'email.com'),
('Backends__r',
OrderedDict([('totalSize', 1),
('done', True),
('records',
[OrderedDict([('attributes',
OrderedDict([('type',
'Backend__c'),
('url',
'/services/data/')])),
('custid__c',
'CUST209522')])])]))]),
I then convert this to a dataframe:
a_query= pd.DataFrame(sf.query_all("SELECT AccEmail__c, (select custid__c from Backends__r where custid__c LIKE '%CUST%') from Account where Id in (select account__c from Backend__c where custid__c LIKE '%CUST%')")['records']).drop(columns=['attributes'])
This drops the attributes column but within the Backends__r there is still all the other attributes.
How can I remove this and only have AccEmail__c and custid__c to store in a table?