Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.

Qlik Replicate and File target: How to rename output files LOAD######## to table name format on Linux

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
john_wang
Support
Support

Qlik Replicate and File target: How to rename output files LOAD######## to table name format on Linux

Last Update:

Aug 1, 2023 4:02:25 AM

Updated By:

Sonja_Bauernfeind

Created date:

May 19, 2023 3:03:31 AM

When using a File as a target in a Qlik Replicate task, the Full Load data are written to CSV or JSON files (depending on the endpoint settings). The Full Load Files are named using incremental counters e.g. LOAD00000001.csvLOAD00000002.csv. This is the default behavior. 

In some scenarios, you may want to use the table name as the file name rather than LOAD########.

This article describes how to rename the output files from LOAD######## to <tableName>######## format while Qlik Replicate running on a Linux platform.

For Qlik Replicate running on a Windows platform, see Qlik Replicate and File target: How to rename output files LOAD######## to table name format on Wind....

Resolution

  1. Open and modify repctl.cfg 

    Default file location: 
    /opt/attunity/replicate/bin 

    Set enable_execute_user_defined_commands from false to true 

    Example: "enable_execute_user_defined_commands": true,

  2. Restart the Qlik Replicate Server service. 

  3. Create an Unix shell file myrename2.sh and save it in the Qlik Replicate Server folder: /opt/attunity/replicate/bin

    Content of the file:
    #!/bin/bash
    dn=$(dirname "$1")
    fn=$(basename "$1")
    extension="${fn##*.}"
    fn="${fn%.*}"
    sn=${fn:4:8}
    mv "$1" "$dn"/"$2"_"$3"__"$sn.$extension"​

    Change the file protection:
    chown attunity:attunity myrename2.sh
    chmod +x myrename2.sh

  4. Set the File Target endpoint and configure it with the following settings:

    General
    Target folder: /opt/attunity/replicate/file/tgt
    Maximum file size(KB): 10240 (default 1000000)

    General Settings.png

    Advanced
    Post-process files
    Command name: /opt/attunity/replicate/bin/myrename2.sh
    Working directory: leave blank
    Parameters: ${FILENAME} ${TABLE_OWNER} ${TABLE_NAME}

    Advanced Settings.png

  5. Startup or Reload the Full Load ONLY task and verify the file output.

    It will typically look like:

    file output linux.png

    Where SCOTT is the source table schema name, KITPK100000 is the source table name, 0000000<n> is the unique incremental number.

    You can tailor the
    myrename2.sh file for any particular needs.

Environment

Qlik Replicate 
File target

 

Related Content:

Qlik Replicate and File target: How to rename output files LOAD######## to table name format on Wind...
Qlik Replicate and ADSL target: How to rename output files LOAD######## to table name format (Replic... 

Internal Investigation ID(s):

Support cases #00080300 

 

 

 

Labels (1)
Version history
Last update:
‎2023-08-01 04:02 AM
Updated by: