Visualizer Function: How to get a URL as an output for a visualization

Learn Aster
Teradata Employee

AppCenter can be used as a visualizations platform to render the visualization JSON objects that are generated by the Visualizer SQL-MR function.  In this setup, AppCenter is not used as a portal, and users are not required to log into AppCenter to view the visualizations.  This setup requires installing AppCenter, and configuring it with a connection to the Aster Cluster, and then running theVisualizer SQL-MR function on the Aster cluster (which can be done from the command line or from a BI tool) with the URL option enabled.


The Visualizer function will then produce a URL that can be:

Manually copied and pasted into a web browser for displaying the data visualization.

OR

Stored in a table that is displayed in a Standard BI tool dashboard.  This option is convenient for BI tool users, because they are presented with a live, clickable URL for displaying the visualization in the default browser window.

THIS IS HOW TO DO IT:

STEP ONE:  CREATE A TABLE TO HOLD YOUR VISUALIZATIONS 

DROP TABLE IF EXISTS public.viz;

CREATE TABLE public.viz
(id bigint,
json varchar,
url varchar)
DISTRIBUTE BY REPLICATION;

STEP TWO: CREATE THE BASE DATA FOR THE VISUALIZATION

In this process I am using bank web clicks data which is available in Aster Express on the community and the following collaborative filter statement. 

If you want to know how to get the data and build and load the data in the bank_web_clicks table please see the following video:

Module 4: Building an Aster Table Loading Data 

SELECT * FROM cfilter (
ON (SELECT 1)
PARTITION BY 1
InputTable ('bank_web_clicks')
OutputTable ('bank_web_clicks_cf')
InputColumns ('product')
JoinColumns ('customer_id', 'session_id'')
AddColumns ('page')
DropTable ('true')
);

STEP 3:  Write the visualizer statement and run in command line our your Query tool or IDE:

INSERT INTO public.viz
SELECT id,json,url FROM Visualizer (
ON "bank_web_clicks_cf" PARTITION BY 1
AsterFunction('cfilter')
Title('Web Pages Used Together - Sigma')
URL('visualization_server=192.168.100.100:444', 'profile=AE', 'output_table=viz')
VizType('sigma')
);

Lets decompose the URL predicate statement highlighted above.

URL('visualization_server=192.168.100.100:444', 'profile=AE', 'output_table=viz')

The URL predicate will tell Aster to run this statement against the Aster AppCenter instance located at the IP address and port number.  Your port number might be different based on your configuration.  The IP address noted above is for AppCenter on Aster Express 6.10.   The profile=AE tells AppCenter what connection information that was set up in Aster AppCenter.  Basically this is a JDBC/ODBC connection to the Aster Cluster that this statement will run against.   The output=viz tells the Visualizer statement what table to place your new visualization (the table we just created).  

When you run the above statement and then do a SELECT * FROM public.viz limit 100; you will get the URL you created:

Copy the URL and put it into a supported Web Browser:

The URL:

https://192.168.100.100:444/appserver/portal/url?profile=AE&outputtable=viz&id=679924701472087

You will then open the url and receive your visual without logging in.