scriptella/scriptella-etl

Example https://github.com/scriptella/scriptella-examples/blob/master/javascript/etl.xml#L40

nolazybits opened this issue · 0 comments

Hello,

I am trying to achieve exactly what is demonstrated in the example
https://github.com/scriptella/scriptella-examples/blob/master/javascript/etl.xml#L40

but it seems that the variable I get is never the modified one :/

<!DOCTYPE etl SYSTEM "http://scriptella.javaforge.com/dtd/etl.dtd">
<etl>
    <properties>
        MYSQL_SERVER=<ip>
        MYSQL_DATABASE=<database>
        MYSQL_USER=<username>
        MYSQL_PASSWORD=<password>
    </properties>

    <description>
        Retreive all the tenants and export to a json file
    </description>

    <!-- Connect to the database -->
    <connection id="DB" url="jdbc:mysql://$MYSQL_SERVER/$MYSQL_DATABASE" user="$MYSQL_USER" password="$MYSQL_PASSWORD" />
    <!-- javascript scripts -->
    <connection id="js" driver="script" />   
    <connection id="log" driver="text"/> <!-- For printing debug information on the console -->

    <query connection-id="DB">
        SELECT * FROM `my_table` ORDER BY login_id;

        <query connection-id="js"> 
            <![CDATA[
                java.lang.System.out.println(name); // output DEFAULT VALUE
                name='NEW NAME'; //Set a transformed value
                java.lang.System.out.println(name); // output NEW NAME
                query.next(); //Don't forget to trigger nested scripts execution
            ]]>

            <script connection-id="log">
                Transformed to $name // output DEFAULT VALUE
            </script>
        </query>
    </query>

</etl>