12-20-2019 9:24 AM
How to access SAP data from windows python, i am working on some projects where i wanted to deal with SAP dataset with Python, need to add rows and columns and modify them from python code. Is there any API or integration by which i can access SAP dataset ??
12-20-2019 9:28 AM
Did you check if your Python could access SAP data through Odata ?
like that https://github.com/SAP/python-pyodata
12-20-2019 5:43 PM
Create a Webservice via TA SICF. There are many tutorials in the web about that. You have to implement the interface if_http_extension and register your class in SICF as a Webservice.
https://blogs.sap.com/2016/10/23/creating-class-handler-sicf-service-code-example/
01-03-2020 1:00 PM
Hi Ranveer, There is a fairly new Python interface to interact with HANA data. https://help.sap.com/doc/1d0ebfe5e8dd44d09606814d83308d4b/latest/en-US/index.html
It allows you to work with the HANA data through Python without having to download the rows. Below is a very basic example, which calculates a new column. The outcome can be saved as view in HANA, it can be persisted as HANA table, or the modified data can be downloaded as pandas dataframe if you must.
import hana_ml.dataframe as dataframe
conn = dataframe.ConnectionContext("hxehost", 39044, "ML", "password")
df_pushdown = conn.sql('SELECT * FROM USEDCARPRICES')
df_pushdown = df_pushdown.select('*', ('YEAR(CURRENT_DATE) - YEAR', 'AGE'))
df_pushdown.save("NAMEOFNEWVIEW", "VIEW")
df_pandas = df_pushdown.collect()
A more comprehensive example that also includes Machine Learning is described on https://blogs.sap.com/2019/11/05/hands-on-tutorial-machine-learning-push-down-to-sap-hana-with-pytho...
11-24-2022 2:19 PM
Hi, try to understand how the module "pyrfc" works.
from pyrfc import Connection.
07-26-2023 1:28 PM
> Hi, try to understand how the module "pyrfc" works.
hope this helps: https://github.com/SAP/PyRFC