Search code examples
hanavora

SAP HANA VORA and Hana CONNECTION


I want to access a table which is already present in SAP HANA from the Spark-shell using SAP HANA Vora.

I created the table using this command:

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

If I execute a show table command it's showing the table name, however when I execute sqlContext.sql("select * from ztemptest").show I get the error as seen in the below screenshot

enter image description here


Solution

  • You need to provide schema name as well .

    Give the code as below:

    %vora 
    CREATE TABLE TABLENAME 
    USING com.sap.spark.hana
    OPTIONS (
       path "HANATABLENAME",
       dbschema "SCHEMANAME",
       host "HANA SYSTEM HOST NAME",
       instance " INSTANCENUMBER",
       user "USERNAME",
       passwd "PASSWORD"
    )