I have activity events from PowerBI event logs and there are multiple types of event activities, and for each activity type the log contains different properties, e.g.
[{ "Activity": "ViewReport", "ReportID": "aaa-bbb-ccc", "WorkspaceID": "eee-fff-ddd"},
{ "Activity": "DatasetRefresh", "DatasetID": "...", "IsSuccess": true}]
(in reality there is around 60 types each with around 20 properties). I want to be able to create as many tables as there is event types and to each table to contain the properties from JSON.
now I'd like to have a proc/sql that will create the table":
Activity_Report_Viewwith all the propsReportID,WroskpaceID,Activity_Dataset_Refreshwith propsDatasetId,IsSuccess
And this needs to be dynamic without me having to list out all the columns manually, something like this (which obviously is not working):
CREATE OR REPLACE TABLE ACTIVITY_REPORT_VIEW AS
SELECT
d.JSON_DATA:*
FROM JSON_TEMP d
WHERE d.JSON_DATA:Activity = 'ViewReport'
ORDER BY d.JSON_DATA:CreationTime DESC;
Thank you