Customer Portal

Finding difference between two datasets

Comments 1

  • Avatar
    admin
    0
    Comment actions Permalink
    Hi Shubha,

    If I understand it correctly, you need to update the database to whatever is in the second table, is that right? If you don't need to keep track of the changes being done to the database table, I would suggest you delete the table rows and replace it with the new data. It is possible to delete all rows in a table without deleting the table. This means that the table structure, attributes, and indexes will be intact. In MySQL you can use the following syntax in a DBExecute component:

    DELETE FROM table_name;


    However, if you would like to also control what has been changed, or update the quantity differently (for example add the new value to the original one), I would like to suggest you a component called DataIntersection. This component intersects data from two inputs and processes them to three output ports as follows: Such input records that are on both the input port 0 and input port 1 are processed according to the user-defined transformation and the result is sent to the output port 1. Such input records that are only on the input port 0 are sent unchanged to the output port 0. Such input records that are only on the input port 1 are sent unchanged to the output port 2. Please note that the component requires sorted data. Based on your example tables I have created an example graph (see the graph attached, I have also included input data that fit the graph's metadata).
    In this example, I have set the transformation within the DataIntersection component to sum the quantities from both inputs if the join key matches (the key, in this case, is Name field). Yet, you can, of course, update the transformation to whatever meets your needs (like send the record to the output unchanged as well).

    Please take a look and let me know if you have any additional questions or concerns.
    Have a nice day, Eva

Please sign in to leave a comment.