vora

How to Create HANA Temp table in Vora Programmatically(Scala)


At the moment a temp table is created using the following statement

val HANA_TABLE = s"""
CREATE TEMPORARY TABLE TEMP_HANA
USING com.sap.spark.hana
OPTIONS (
path "TABLE",
host "HANA1",
dbschema "SCHEMA",
user "USER",
passwd "PASSWD",
instance "22"
)"""
vc.sql(HANA_TABLE);

Is there a way to do this Programmatically in scala? like
vc.read.format("com.sap.spark.hana").options(options).loadTemp()

on a side note is there an API for Vora?


Solution

  • Please see the Vora Developer Guide -> Chapter "8 Accessing Data in SAP HANA"

    Your example could be written in this way

    val options = Map(
      "dbschema" -> "SCHEMA",
      "path"     -> "TABLE",
      "host"     -> "HANA1",
      "instance" -> "22",
      "user"     -> "USER",
      "passwd"   -> "PASSWD"
     ) 
    
    val inputDF = vc.read.format("com.sap.spark.hana").options(options).load()
    inputDF.registerTempTable("TEMP_HANA")
    
    vc.sql("select * from TEMP_HANA").show