Using Python 

Syntax

x_python <python_script_file> [<arguments>...]

Possible call arguments:

x_python <python_script_file> <userid> <password> <dbname> <data_path>

Prerequisites

The following Python modules are shipped with the Replication Manager program and enable you to write Python scripts that can be processed with the REPM Server.

These are the modules you need to use the REPM Server functions. You do not need a complete PYTHON installation.

If you already have a PYTHON installation, add %INSTROOT%\misc to the PYTHONPATH variable.

The Replication Manager supports PYTHON as of version 1.5.2.

Template for Batch Files

The following section contains examples of batch files in Python. Their equivalents in the Perl script language are also provided for comparison.

Example no. 1
Build a Python module with reference to the SAP DB Python Libraries,
parse the call arguments


Python


Perl

Example. 2
Set up a user session with the REPM Server,
Log onto the database instance,
Log off



Python



Perl

Example no. 3
Set up a user session,
Log onto the database instance,
Query error code to determine whether table exists
Create a table without querying the error code
Log off



Python



Perl

Example no. 4
Start a user session
Log onto the database instance
Create a table and query the error code
Load data to the table using
REPM Server command(s) and query the error code
Log off




Python




Perl

Example no. 5
Start a user session
Log onto the database instance
Load data to the table using REPM Server command(s) and intercept exceptions
Log off



Python



Perl

Python Classes