Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Python combining Audit metrics data logs from each API call

When ever I make an API call I am getting below sample data. Due to API call limitations ican only return 5000 recors at a time. if I have 50000 records I have to make 10 calls with 5000 records in each call.
Now I want to combine all these records into a single dictionary and then export into a csv file.

Code I have tried and failed, since the below codes are updating records in one of the dictionaries if the value exist


pd1 = pd.DataFrame(data)
pd2 = pd.DataFrame(data_1)
print(pd1.append(pd2))

def Merge(dict1, dict2):
res = {**dict1, **dict2}
return res

# Sample 2
dict1 = {'a': 10, 'b': 8}
dict2 = {'d': 6, 'c': 4}
dict3 = Merge(dict1, dict2)
print(dict3)

Sample Data:

*{'@odata.context': 'http://wabi-us-north-central-f-primary-redirect.analysis.windows.net/v1.0/myorg/admin/$metadata#grou...', '@odata.count': 2754, 'value': [{'id': 'ABCDEF-EC21-ABCDFEG-A6F9-fsdafsadf', 'isReadOnly': False, 'isOnDedicatedCapacity': True, 'capacityId': 'sdfasdfasd-F3A6-gfda-dsafas-asdfasd', 'capacityMigrationStatus': 'Migrated', 'type': 'Workspace', 'state': 'Active', 'name': 'DSS Dev Workspace', 'datasets': [{'id': 'sdfas-3436-fasdfas-a377-dsfa', 'name': 'Net Revenue Reporting v2', 'addRowsAPIEnabled': False, 'configuredBy': 'asdf.fdsa@asdfgasdf.com', 'isRefreshable': True, 'isEffectiveIdentityRequired': False, 'isEffectiveIdentityRolesRequired': False, 'targetStorageMode': 'Abf', 'createdDate': '2019-09-18T20:05:21.887Z', 'contentProviderType': 'PbixInImportMode', 'upstreamDatasets': [], 'schemaMayNotBeUpToDate': False, 'users': []}, {'id': 'e102e519-8fa1-4e2f-95b4-d6e0fa85960a', 'name': 'Month Stats Review (1)', 'addRowsAPIEnabled': False, 'configuredBy': 'fasd.fasd@afdsasd.com', 'isRefreshable': True, 'isEffectiveIdentityRequired': False, 'isEffectiveIdentityRolesRequired': False, 'targetStorageMode': 'Abf', 'createdDate': '2020-02-28T21:27:09.147Z', 'contentProviderType': 'PbixInImportMode', 'upstreamDatasets': [], 'schemaMayNotBeUpToDate': False, 'users': []}]}]}*

2 REPLIES 2
Anonymous
Not applicable

Hi Guys

I eneded up going one level down (value property) where the data is stored in list format. I have appended all data to a list and exported to txt file. As shown below.

 

'value': [{'id': 'ABCDEF-EC21-ABCDFEG-A6F9-fsdafsadf', 'isReadOnly': False, 'isOnDedicatedCapacity': True, 'capacityId': 'sdfasdfasd-F3A6-gfda-dsafas-asdfasd', 'capacityMigrationStatus': 'Migrated', 'type': 'Workspace', 'state': 'Active', 'name': 'DSS Dev Workspace', 'datasets': [{'id': 'sdfas-3436-fasdfas-a377-dsfa', 'name': 'Net Revenue Reporting v2', 'addRowsAPIEnabled': False, 'configuredBy': 'asdf.fdsa@asdfgasdf.com', 'isRefreshable': True, 'isEffectiveIdentityRequired': False, 'isEffectiveIdentityRolesRequired': False, 'targetStorageMode': 'Abf', 'createdDate': '2019-09-18T20:05:21.887Z', 'contentProviderType': 'PbixInImportMode', 'upstreamDatasets': [], 'schemaMayNotBeUpToDate': False, 'users': []}, {'id': 'e102e519-8fa1-4e2f-95b4-d6e0fa85960a', 'name': 'Month Stats Review (1)', 'addRowsAPIEnabled': False, 'configuredBy': 'fasd.fasd@afdsasd.com', 'isRefreshable': True, 'isEffectiveIdentityRequired': False, 'isEffectiveIdentityRolesRequired': False, 'targetStorageMode': 'Abf', 'createdDate': '2020-02-28T21:27:09.147Z', 'contentProviderType': 'PbixInImportMode', 'upstreamDatasets': [], 'schemaMayNotBeUpToDate': False, 'users': []}]}]

 

 

Anonymous
Not applicable

Hi @Anonymous 

I found some blogs, I hope they can help you.

Use Python in Power Query Editor

How to use Python/R to analyze a joined table in Power BI?

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.