Create CSV of an ElastiCube's Tables, Columns, and Data Types
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)
Updated 03-02-2023
intapiuser
Admin
Joined December 15, 2022