Query SAP database from Python?

Python SAP RFC module seems inactive - last (insignificant ) commit 2 years ago - but may serve you:

Pysaprfc is a wrapper around SAP librfc (librfc32.dll on Windows, librfccm.so or librfc.so on Linux). It uses the excellent ctypes extension package by Thomas Heller to access librfc and to define SAP compatible datatypes.

Modern SAP versions go the Web Service way - you could build a SAP Web Service and consume it from Python.

With SAP NetWeaver, developers can connect applications and data sources to integrate processes using Web services.

In particular, developers can use one infrastructure to define, implement, and use Web services in an industry standards based way. SAP NetWeaver supports synchronous, asynchronous, stateful and stateless web service models - enabling developers to support different integration scenarios.

sapnwrfc supports this SAP NetWeaver functionality, supersedes the older RFC SDK, and is actively maintained.


SAP now has a Python RFC connector called pyrfc. This supersedes sapnwrfc.

This can be found at: https://github.com/SAP/PyRFC

"The pyrfc Python package provides Python bindings for SAP NetWeaver RFC Library, for a comfortable way of calling ABAP modules from Python and Python modules from ABAP, via SAP Remote Function Call (RFC) protocol."


Python RFC connector is now available as open source: PyRFC