Entering content frame

Background documentation Python: Loader Class Locate the document in its SAP Library structure

Constructor: Loader (<server_node>, <database_name>)

<server_node>

Server node name

<database_name>

Name of the database instance

Establishing a connection to the Loader.

If the server node name and name of the database instance are specified, the system assumes that the database instance, data, and Loader are located on a remote server.

If only the name of the database instance is specified, the system assumes that the database instance, data, and Loader are located on the local server. The suitable Loader is determined from the version of the specified database instance.

If neither the server node name nor the name of the database instance is specified, the system establishes a connection to the newest Loader version on the local system.

The session is closed again when the object is deleted with del session.

Example

session = loader.Loader ('p12345', 'mydb')

Method: cmd (<command_string>)

An SQL statement or Loader command is executed.

The script is terminated if the command fails.

Example

output = session.cmd ("""DATALOAD TABLE customer
                     cno       1-4
                     name      6-12
                     zip      14-18
                     city     20-31
                     INFILE '%s\customer.dat' """ %data_path)

Method: sql (<command_string>)

An SQL statement or a Loader command is executed.

If a command fails, execution of the script is terminated.

If an SQL statement fails, a return code is output.

Example

result = session.sql ('EXISTS TABLE MYTABLE')

 

Leaving content frame