Using Python
import libraries
import pandas as pd
import json
Open the JSON Smodel / downloaded model from API.
You may also use the API to hit the Get Elasticube JSON endpoint
with open('response.json') as json_file:
data = json.load(json_file)
Make a list of lists to be formatted as a data frame for export
elementsForFrame = []
for dataset in data['datasets']:
for table in dataset['schema']['tables']:
for column in table['columns']:
elementsForFrame.append([table['name'], column['name'], column['type']])
Make a data frame with columns table, column, and type
df=pd.DataFrame(elementsForFrame, columns= ['table', 'column', 'type'])
df.head()
Out[4]:
Export to CSV in the working directory
df.to_csv('Ecommerce Data.csv' ,index=False)