HowTo: Python


Prerequisites


All the files required to run the examples are contained in the directory demo/FirstSteps/Python.


Accessing SQL using the sapdb module

Hello, SAP DB
HelloSAPDB.py shows
  • how to connect to the database
  • how to execute SQL
  • how to fetch results
  • execute it as
    python HelloSAPDB.py <sqluser> <password> <dbname> <host>
    The command line arguments are optional, the defaults will access the installed demo database


Accessing SQL using the Python Database API

The Database API for SAP DB is still in development.


Accessing the DB Manager using the dbm module

Database state
StateSAPDB.py shows
  • how to connect to the Database Manager
  • how to execute simple commands using the dbmcli syntax
  • how to parse results
  • execute it as
    python StateSAPDB.py <dbmuser> <password> <dbname> <host>
    The command line arguments are optional, the defaults will access the installed demo database