Possible to show a jpg/png or url in app?

Teradata AppCenter
AppCenter is a framework to build, share, deploy and consume big data apps for self-service analytics and discovery for the business community.

Possible to show a jpg/png or url in app?

I'd like to show visualizations made with (Aster)R in an App. Particularly because using R it's much easier to make functions generic and loop over all colums of a dataset. It's also much easier to alter the theming of a graph.


Is it possible to show a jpg or png (saved from R) in an Aster App?

For instance from the Aster logical filesystem or from an external URL.


What would be the syntax to do something like that?

Teradata Employee

Re: Possible to show a jpg/png or url in app?

Teradata AppCenter supports a variety of built-in visualizations formats and types based on specific table structures for apps that run once or on schedule and SQL scripts:


Is that you want?


For script devlopment, present SQL, BTEQ and Aster Java Python are supported. Other languages such as and R are not supported yet.


Re: Possible to show a jpg/png or url in app?

Thanks for the reply.

Not quite...


I'm findign that the standard visualizations are too limited for what I want to do.

I was wondering if it's possible to simply display a jpg/png in an appcenter visualization.


The workflow would be something like this:

App > perform R code on the cluster by invoking STREAM from the App > R code saves 1 or more image files on the cluster > display the image(s) in the App



Teradata Employee

Re: Possible to show a jpg/png or url in app?

Thank you for the information.

You can retrieve the image via SQL query. Here's a sample in the Aster App Center(but we haven't tried this in Teradata AppCenter):

--1. Table to hold images and labels
drop table if exists dbname.html_images;
create table dbname.html_images (
 label varchar(40),
 html_img varchar
)distribute by replication compress low;

--2a. Put the images on the queen and reference that location in the table
-- * FTP with port 22
-- * Navigate here: /opt/teradata/appserver/tomcat/current/webapps/appserver/static/img/
--  * Make a new folder called pics_to_viz and put everything there
insert into dbname.html_images (label, html_img) values
('snow_hare','<img src="/appserver/static/img/pics_to_viz/snow-hair.jpg" height="100" width="150">')

--2b. Use the data inline scheme to hard code the picture into our in the table
--  * https://www.base64-image.de/ to get base64 encoding of images

insert into dbname.html_images (label, html_img) values
 ('german_sheppard_puppy','<img src="data&colon;image/png;base64,/9j/...... It is too long to copy here......" />')

--3. Join to other tables to use these in any table, including confusion matrix or whatever else
drop table if exists dbname.results_to_viz;
create table dbname.results_to_viz
 distribute by replication compress low as (
 select cuteness_ranking, html_img
 from (
  select 1 as cuteness_ranking, 'german_sheppard_puppy' as picture
  union all
  select 2 as cuteness_ranking, 'snow_hare' as picture
 ) as some_base_table
 join dbname.html_images
  on picture = label

insert into app_center_visualizations (json) values (
     "where" : "",