Export repository to XML file

Description

This job entry exports repository objects from a given repository into one or multiple files in the XML format.

Multiple files are generated when the option Export by folder is checked.

For an automated repository export, you can use named parameters and combine this with command line options when calling via Kitchen. An example of exporting one folder and it's child folders of a repository to an XML file by command line can be found below.

see also:

Options

Option

Description

Job entry name

The name of the job entry.
Note : This name has to be unique in a single job. A job entry can be placed several times on the canvas, however it will be the same job entry.

Repository name

The name of the repository to export

Repository user

The username with sufficient user access rights for the export

Repository password

The corresponding password

Export Type

Export all objects: Exports all jobs, transformations and connections of the whole repository

Export only jobs: Export all jobs of the whole repository

Export only transformations: Export all transformations of the whole repository

Export by folder: Loop over all the directory folders and export all folders that match the target folder. In this case the Target folder / filename option must be given only as a folder and the last folder is extracted and used to compare for the match.

Export one folder: Export all jobs, transformations and connections of the given folder (also recursive below the folder)

Foldername

Export this given foldername (not used by the Export by folder option)

Create separate folder

Only used by the Export by folder option: Creates a separate folder and build the folder name out of the repository path by eliminating the slashes.

Target folder / filename

Normally this is the target folder & filename
When the Export by folder option is selected, this is only the folder name

Create folder

This creates the target folder in the filesystem when it does not exist.

Add date to filename

Adds the date like yyyyMMdd to the filename.

Add time to filename

Adds the time like HHmmssSSS to the filename.

Specify date time format

Adds the specified date time format to the filename.

If target file exists

Select the appropriate option when the target file already exists: Skip, Replace file, Create file with unique name or Fail

Add filenames to result

This adds the filename to the internal file result set.

Success condition

Put this job entry into success when Success when all works fine or Success when Number of errors is lesser than the limit

Limit

Defines the limit for errors when the option Success when Number of errors is lesser than is checked

Sample for an Automated Process

This is an example of exporting one folder and it's child folders of a repository to an XML file.
It can be executed via the command line, setting the named parameters (see Job properties for the list of parameters) accordingly.

This sample exports one folder, but it can simply be changed to export the whole repository by changing the properties of the job entry.

It is also possible to add further job entries and error handling into this process. E.g. sending the exported repository via mail or put to a FTP site.
The following named parameters are used in the job entry:

and defined within the job properties:

To execute the export job via Kitchen, you can call it similar like this sample from the command line:

call kitchen.bat /file:C:\Pentaho_samples\repository\repository_export.kjb (file:C:\Pentaho\_samples\repository\repository_export.kjb) "/param:rep_name=PDI2000" "/param:rep_user=joe" "/param:rep_password=password" "/param:rep_folder=/public/dev" "/param:target_filename=C:\Pentaho_samples\repository\export\dev.xml"

Note: It is also possible to use obfuscated passwords with Encr (Command line tool for encrypting strings for storage / use by PDI)

Example for executing a complete call for the export with also checking for any errors:

@echo off
ECHO This an example of a batch file calling the repository_export.kjb

cd C:\Pentaho\pdi-ee-4.2.1-GA\data-integration

call kitchen.bat /file:C:\Pentaho_samples\repository\repository_export.kjb (file:C:\Pentaho\_samples\repository\repository_export.kjb) "/param:rep_name=PDI2000" "/param:rep_user=joe" "/param:rep_password=password" "/param:rep_folder=/public/dev" "/param:target_filename=C:\Pentaho_samples\repository\export\dev.xml"

if errorlevel 1 goto error
echo Export finished successfull.
goto finished

:error
echo ERROR: An error occured during repository export.
:finished

REM Allow the user to read the message when testing, so having a pause
pause

The sample is attached to this page.