Navigate to: Resources > Data Sources
Select the SAP HANA Cloud icon:
Name (required)
Host (required):
Enter the hostname of your SAP HANA Cloud database.
Example: ww23456-1db2-4dd0-8cbe-71521705c697.hana.prod-eu10.hanacloud.ondemand.com
Port (required): 30015 or 443 are default values
Database (optional)
Credential Type: See Data Source Security
Username (required - can be entered later): Username used for connecting to SAP HANA Cloud
Password (required - can be entered later): Password used for connecting to SAP HANA Cloud
%pythonimport pandas as pd# Create dbapi Connection objectconn = z.getDatasource("zepl_docs_sap_hana")# Create dbapi Cursor objectcursor = conn.cursor()# Create SQL statementsql_command = 'SELECT * FROM "ZEPL"."View_1" LIMIT 100;'# Execute SQL statment and fetch resultscursor.execute(sql_command)data = cursor.fetchall()# Convert to Pandas DataFramedf = pd.DataFrame(data)df.columns = [col[0] for col in cursor.description]z.show(df)
Use z.getDatasource()
to return SAP Connection Object: pyhdbcli.Connection
%datasource.zepl_docs_sap_hanaSELECT * FROM "ZEPL"."View_1" LIMIT 3;
%pythonimport pandas as pd# Create dbapi Connection objectconn = z.getDatasource("zepl_docs_sap_hana")# Create dbapi Cursor objectcursor = conn.cursor()# Values to insert into the HANA table. This is an example, but these values can come from a list or dataframe. Simply loop through and insert each row.sql = "INSERT INTO \"ZEPL\".\"View_1\" VALUES(19, 'PAYMENT', 1234.00, 'C1616398702',0, 0, 'M2089277435',0,0, FALSE, FALSE )"# Insert row into SAP HANAcursor.execute(sql)# Display number of rows inserted successfullycursor.rowcount
Please reference SAP's Documentation to setup your SAP HANA database environment. One recommended method of access is through SAP Data Warehouse Cloud (DWC). Create a Space for your Zepl project and Database Users with both Ingest and Consumption enabled. You will be given a Username and Password that you can enter into the Zepl Data Source inputs.