Data Warehouse

Tutorial Videos

API

Storage and Compute

Data Sources

CDC Setup

Transform

KPI

Models
Segments

Dashboard

Drill Down

Explores

Machine Learning

Sharing

Scheduling

Notifications

View Activity

Admin

Launch On Cloud

FAQs

FAQ's

Security

Feedback

Option to take feedback from UI

Release Notes

Release Notes

Overview

Models

Segments

Overview

A Cube is needed to create segments. By choosing dimensions and measures on your cube, segments can be created. Dimensions are used to bucket or group the measures for e.g. by country, city, and region. There can be multiple dimensions in a cube, say for example, like total sales by a country, top 10 users by sum of sales, etc. Here total sales is a measure, country is a dimension. By choosing country as dimension we can see the total sales by a country. In this way, we can create multiple segments. Basically segment is a report that gives deep analysis on particular dimension.

The page lists all the segments that have been created by you and other team members.

  • My Segments tab Lists all segments owned by you.
  • Shared with me tab Lists all the segments (identified by the owner field).

Segment View

The page lists the result of the latest job run on your segment report. The segment report can be scheduled thereby relieving you for running the same report again and again. You can schedule segment report for your daily, weekly or monthly reports.

  • Email button
  • Report through Emails to your team members. Email can be scheduled daily, weekly or monthly.
  • Save button
  • Save changes made to the chart options.

Segment Edit

This page provides the ability to modify your existing segment reports by adding or removing dimensions or measures, re running report again or schedule the segment report for auto run.

  • Save And Run
  • After you are done editing your report click this button to get the latest results. A new job is launched and results are available in the result view below.
  • Auto-Run
  • Schedule segment report. The segment report will run every night at scheduled time of 00:30 AM. Users with Developer role can change the default schedule.
  • Save
  • Save your changes. Job is not run in this case and only measures and dimensions are saved.

Cube

Select a cube to prepare a segment report. Selecting a cube will list the dimensions and measures within that cube.

Filter

Restrict the data that is aggregated further by choosing appropriate filters on the dimensions.

Jobs

For every run of your segment query, a job is launched against your cluster. A job has a state of Queued, Running, Success, Failed and Cancelled. To see the results of Job, click Show. You can also see the results of the last 3 successful jobs run by choosing the job and click Show. The reason for last 3 failed jobs are also listed.

Result

The results of the job are displayed as a data table. You can download the result as a CSV file also.

import requests
from requests.auth import HTTPBasicAuth

auth =  HTTPBasicAuth(<API_KEY>, <API_SECRET>)
response = requests.get("https://<hostname>/api/v0.4/explore/streamresult/<EXPLORE_ID>", auth)

print(response.content)

library('httr')

username = '<API KEY>'
password = '<API SECRET>'

temp = GET("https://<hostname>/api/v0.4/explore/streamresult/<EXPLORE ID>",
           authenticate(username,password, type = "basic"))

temp = content(temp, 'text')
temp = textConnection(temp)
temp = read.csv(temp)

/*Download the Data*/

filename resp temp;
proc http
url="https://<hostname>/api/v0.4/explore/streamresult/<EXPLORE ID>"
   method= "GET"  
   WEBUSERNAME = "<API KEY>"
   WEBPASSWORD = "<API SECRET>"
   out=resp;
run;

/*Import the data in to csv dataset*/
proc import
   file=resp
   out=csvresp
   dbms=csv;
run;

/*Print the data */
PROC PRINT DATA=csvresp;
RUN;

import requests
import json

url='http://hostname/api/v0.4/createCSV'

username='API_KEY'
password='API_SECRET'

files={'file':open('FILE_PATH.csv','rb')}
values={'projectname':PROJECT_NAME','name':'CSV_DATASOURCE_NAME'}

r=requests.post(url, files=files, data=values, auth=(username,password))

res_json=json.loads(r.text)

print(res_json['success'])

import requests
import json

url='http://hostname/api/v0.4/updateCSV'

username='API_KEY'
password='API_SECRET'

files={'file':open('FILE_PATH.csv','rb')}
values={'projectname':PROJECT_NAME','name':'CSV_DATASOURCE_NAME'}

r=requests.post(url, files=files, data=values, auth=(username,password))

res_json=json.loads(r.text)

print(res_json['success'])

import requests

url='https://<hostname>/api/v0.4/explore/streamresult/<EXPLORE ID>'

username='API_KEY'
password='API_SECRET'

r=requests.get(url,auth=(username,password))
print(r)
print(r.text)

import requests

import pandas as pd

import io

url='https://<hostname>/api/v0.4/explore/streamresult/<EXPLORE ID>'

secret='API_SECRET'

r=requests.get(url,headers = {'Authorization': 'SprinkleUserKeys ' +secret } )

df = pd.read_csv(io.StringIO(r.text),sep=',')

import requests

import pandas as pd

import io

url='https://<hostname>/api/v0.4/segment/streamresult/<SEGMENT ID>'

secret='API_SECRET'

r=requests.get(url,headers = {'Authorization': 'SprinkleUserKeys ' +secret } )

df = pd.read_csv(io.StringIO(r.text),sep=',')

import requests

import json

url='http://hostname/api/v.o4/createCSV'

files={'file':open('path/file.csv’')}

values={'projectname':PROJECT_NAME,'name':'csv_datasource_name/table_name'}

secret='API_SECRET'

r=requests.post(url, files=files, data=values, headers = {'Authorization': 'SprinkleUserKeys ' +secret } )

res_json=json.loads(r.text)

import requests

import json

url='http://hostname/api/v.o4/updateCSV'

files={'file':open('path/file.csv’')}

values={'projectname':PROJECT_NAME,'name':'csv_datasource_name/table_name'}

secret='API_SECRET'

r=requests.post(url, files=files, data=values,headers = {'Authorization': 'SprinkleUserKeys ' +secret } )

res_json=json.loads(r.text)