Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Quick Tips: Apache Phoenix and Zeppelin

DZone's Guide to

Quick Tips: Apache Phoenix and Zeppelin

Quick tips to keep in mind when querying Phoenix from Zeppelin and to quickly add graphics to Zeppelin tables.

· Big Data Zone ·
Free Resource

Hortonworks Sandbox for HDP and HDF is your chance to get started on learning, developing, testing and trying out new features. Each download comes preconfigured with interactive tutorials, sample data and developments from the Apache community.

Image title

When querying Phoenix from Zeppelin, you can display images and do other HTML right inside your query results.

For building an image:

%jdbc(phoenix)

select '%html <img width=50 height=60 src="' ||  profile_image_url || 
'">' as imgp,substr(inception,131,150) as inception, 
substr(sentiment,0,60) as sentiment,
       handle,substr(msg,0,60) as msg, time, location,
       stanfordsentiment, followers_count, hashtags
from tweets where handle = 'hortonworks' and inception is not null

As you can see, to add HTML you merely have to use '%html to start your HTML segment within your query. The syntax is very particular and you must encode quotes.   The easiest option is to use double quotes for all HTML quotes inside your HTML sections.   To add variables and other pieces, the concatenation operator in Apache Phoenix is the double pipe (||).

This will let you quickly add graphics to your Zeppelin tables.

Image title

References

Hortonworks Sandbox for HDP and HDF is your chance to get started on learning, developing, testing and trying out new features. Each download comes preconfigured with interactive tutorials, sample data and developments from the Apache community.

Topics:
phoenix ,hbase ,big data ,hortonworks ,zeppelin

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}