on 07-16-2021 9:51 AM
via python code , I can do batch insert to HANA table ( code sample below )
_list = []
# loop and add tuples to the _list
_list.append( tuple ( ( value1, values2 , values3 )) )
PARAMS = '?,?,?'
SQL = f"insert into schema.table values ( {PARAMS})"
cursor.executemany(SQL , _SQL_TUPLE)
How can we achieve the same in HANA client
Hi Rajarshi, The hana_ml library has a nice feature to load data from Python to HANA. it uses the SAP HANA Python driver under the hood. Just turn your data into a Pandas dataframe and upload to a HANA table. It can create the target table, or just append the new rows. Just check with your Account Executive if your HANA license is allowing for this usage. https://help.sap.com/doc/1d0ebfe5e8dd44d09606814d83308d4b/2.0.05/en-US/html/hana_ml.dataframe.html#h...
import hana_ml.dataframe as dataframe
df_remote = dataframe.create_dataframe_from_pandas(connection_context = conn,
pandas_df = df_data,
table_name = 'TARGETTABLE',
force = True,
replace = False)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rajarshi,
This blog SAP Data Intelligence: Insert JSON Data into SAP HANA or SAP Data Warehouse Cloud should be helpful for your question. You can also refer to the sample graph named "Load Files into HANA" provided by SAP Data Intelligence.
Regards,
/Andy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.