cancel
Showing results for 
Search instead for 
Did you mean: 
intapiuser
Community Team Member
Community Team Member
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()
 

Export to CSV in the working directory

df.to_csv('Ecommerce Data.csv' ,index=False)
Rate this article:
Version history
Last update:
‎03-02-2023 09:14 AM
Updated by:
Contributors