Customer Portal

Transaction management

Comments 3

  • Avatar
    avackova
    0
    Comment actions Permalink
    Hi,
    if you send all data from Validation Component in one record you can do it with DBOutputTable component:
    <Node dbConnection="Connection0"  id="DB_OUTPUT_TABLE0" sqlQuery="insert into REJECTED_DATA_TBL values ($transformed_field1, $transformed_field2, $transformed_field3);
    insert into REJECTION_REASONS_TBL values($rejectionReason);
    delete from SOURCE_TBL where field1=$original_field1,field1=$original_field2, field3=$original_field3;" type="DB_OUTPUT_TABLE"/>

    It does all 3 statements in one transaction.
  • Avatar
    drasko
    0
    Comment actions Permalink
    Hi,
    I cannot send all data from Validation Component in one record because I can have more than one record to insert into REJECTION_REASONS_TBL for each record transferred to REJECTED_DATA_TBL.

    In fact, my question could be asked in another way:
    Can I send a data structure representing one to many relationships (ie. one record for REJECTED_DATA_TBL and several records (1..n) for REJECTION_REASONS_TBL) from one component (ie. Validation component) to another component (ie. a database write custom component) and still treat them as a unity. I know that I can do that by using something as a Merge component but in that case the Merge component will have to wait for all records to be processed before starting to treat the data. I don’t want to do that. I want to treat one input record (becoming one to many relationships) at a time.

    My scenario would be as following:
    1.DBInputTable reads everything from SOURCE_TBL
    2.DBInputTable pass one record at a time to a custom component that validates each record (ValidationComponent).
    3.ValidationComponent validates a record at a time and, if not valid, create a rejected record and several rejection reason records (1..n) and sends them to a Database Write custom component.
    4. Database Write custom component takes the input corresponding to one record from SOURCE_TBL (one rejected record and several rejection reason records) and inserts them in the database in a transaction
    5. And so on, for each record from DBInputTable

    Thanks
  • Avatar
    avackova
    0
    Comment actions Permalink
    Hi,
    I concern that is not possible in current Clover.ETL development level. You can write sets of records to different flat files (using partitionKey and partitionFileTag attributes on DataWriter), but not to database in one transaction. We plan to extend metadata to be more level structure in the future; in such case you could have one record on one field, but in current version it's impossible :(

Please sign in to leave a comment.