How to pull Data into python from SAP ERP

3.7k views Asked by At

I am a data scientist and do not have any prior background in SAP.

I need to pull data (query and Qube) from SAP ERP to python for some predictions and automate the process. but I am not able to find the right answer to this. our SAP ERP runs on the Oracle database but I don't have access to pull data directly from oracle, also we have SAP BW. Please help

2

There are 2 answers

0
Hrvoje On

You can start with tutorials like this one. After that you can ask more specific question when you get stuck.

1
Shivendra singh On

You can get data using various ways, or using different Data Ingestion tools. It would also depend upon multiple factors but naming a few

  • On-premise or Cloud(AWS, Azure, GCP)
  • Whether you want to get data only once or on daily basis.

I am assuming you want to get data only once and your DB connectivity is working fine. Install these, if they are not

pip install pandas
pip install SQLAlchemy
pip install cx_Oracle

In your python notebook or IDE

import pandas as pd
import cx_Oracle
import sqlalchemy

Add appropriate values of (user, password, hostIP:Port , service_name) in engine.

engine = sqlalchemy.create_engine("oracle+cx_oracle://user:password@hostIP:port/service_name=DB_name", arraysize=1000)
SQL_query = """SELECT* from table"""
df = pd.read_sql(SQL_query, engine)