Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Fukuhara
Advisor
Advisor
0 Kudos

Environment

Here is environment I tested.

TypeVersion
Python3.10.2
hana_ml2.20.24031902
HANA Cloud4.00.000.00.1710841718 (fa/CE2024.2)

Code

Just a simple code snippet for define, insert and select with join tables.

 

 

from hana_ml.dataframe import ConnectionContext, create_dataframe_from_pandas
import pandas as pd

HOST = '<host>'
USER = '<user>'
PASS = '<password>'
conn = ConnectionContext(address=HOST, port=443,  user=USER,
                           password=PASS, schema=USER, encrypt=True, sslValidateCertificate=False) 

TAB = '#TEST_TBL'  # local tem table
TAB2 = 'TEST_TBL'
COL = 'COL'
df = pd.DataFrame({COL: [1, 2, 4]})

conn.clean_up_temporary_tables()
conn.create_table(table=TAB, table_structure={COL: 'VARCHAR(50)'})

create_dataframe_from_pandas(conn, df, TAB, drop_exist_tab=False)
create_dataframe_from_pandas(conn, df, TAB2, force=True, drop_exist_tab=True)

conn.table(TAB).alias('L').join(conn.table(TAB2).alias('R'), 'L.COL = R.COL').collect()