CData Python Connector for SAP ERP

Build 22.0.8462

From Pandas

When combined with the connector, Pandas can be used to generate data frames which contains your SAP ERP data. Once created, a data frame can be passed to various other python packages.

Connecting

Pandas will need to be imported before it can be used. Pandas will also rely on a SQLAlchemy engine when executing queries, as below:

import pandas as pd
from sqlalchemy import create_engine
engine = create_engine("saperp:///?Host=sap.mydomain.com;User=EXT90033;Password=xxx;Client=800;System Number=09;ConnectionType=Classic;")

Querying Data

SELECT queries are provided in a call to the "read_sql()" method in pandas, alongside a relevant connection object. Pandas will execute the query on that connection, and return the results in the form of a data frame, which are used for a variety of purposes.

df = pd.read_sql("""
	SELECT
	   MANDT,
	   MATNR,
     $exNumericCol;
	FROM MARA;""", engine)
print(df)

Copyright (c) 2023 CData Software, Inc. - All rights reserved.
Build 22.0.8462