- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Created on 09-26-2016 09:31 PM - edited 08-17-2019 09:36 AM
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:
- 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
- In Zeppelin click Create new note, name the notebook as you like ex "interact with hana data"
- 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| +------------+-------------+--------+-----+-------+