Community Articles
Find and share helpful community-sourced technical articles
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.
Labels (2)

This article "Perform Data Analysis using SAP Vora on SAP Hana data - Part 4" is continuation of "Load Demo data in SAP Vora Using Eclipse HANA Modelling tools - Part 3"

Log back in to SAP Cloud Appliance Library - the free service to manage your SAP solutions in the public cloud. You should have HANA and Vora instances up and running:

8003-screen-shot-2016-09-26-at-104614-am.png

  1. Open Apache Zeppelin web UI click on Connect in your SAP HANA Vora instance in CAL, and then pick Open a link for Application: Zeppelin
  2. In Zeppelin click Create new note, name the notebook as you like ex "interact with hana data"
  3. In the first cell lets define our imports and HANA connection information
import sqlContext.implicits._
import scala.collection.mutable.Map


val HANA_HOSTNAME = "xxx.xxx.xx.xxx"
val HANA_INSTANCE = "00"
val HANA_SCHEMA = "CODEJAMMER"
val HANA_USERNAME = "CODEJAMMER"
val HANA_PASSWORD = "CodeJam2016"

4. In the next cell we will use sqlContext that was automatically created by Zeppelin to Connect to HANA using "com.sap.spark.hana"

sqlContext.sql( s"""
    CREATE TABLE EMPLOYEE_ADDRESS 
    USING
      com.sap.spark.hana
    OPTIONS (
      path         "EMPLOYEE_ADDRESS",
      host         "${HANA_HOSTNAME}",
      dbschema     "${HANA_SCHEMA}",
      user         "${HANA_USERNAME}",
      passwd       "${HANA_PASSWORD}",
      instance     "${HANA_INSTANCE}"
    )
    """.stripMargin )

5. Now lets query the HANA database from Zeppelin

sqlContext.sql("select * from EMPLOYEE_ADDRESS").show

You should get the results from the EMPLOYEE_ADDRESS table we created earlier.

+------------+-------------+--------+-----+-------+
|STREETNUMBER|       STREET|LOCALITY|STATE|COUNTRY|
+------------+-------------+--------+-----+-------+
|         555|  Madison Ave|New York|   NY|America|
|          95|Morten Street|New York|   NY|    USA|
+------------+-------------+--------+-----+-------+

8019-screen-shot-2016-09-26-at-53041-pm.png

1,532 Views
Don't have an account?
Coming from Hortonworks? Activate your account here
Version history
Revision #:
2 of 2
Last update:
‎08-17-2019 09:36 AM
Updated by:
 
Contributors
Top Kudoed Authors