Options

how to updated status column at runtime from write database

sgnarkhede2016sgnarkhede2016 Member Posts: 152 Contributor II
edited April 2020 in Help
Hello,
I have created one column in db "status"
I want to update the status of records are written in db or not in status column

e.g
Data I/p =>Generate attribute(Status- "Started)=>  Updated db(Status)=> Write Db => Generate attribute(Status- "Completed)=>  Updated db(Status)

Currently I am trying this ways but how can I identify if process failed in the middle then after "Write Db" part not executed then how can i know which data not write

Tagged:

Answers

  • Options
    hbajpaihbajpai Member Posts: 102 Unicorn
    Hey @sgnarkhede2016 ,

    If you can know common errors, it is best to build to isolate the use cases and build contingencies for the same in your process. The operator I use a lot for these cases is handle exception and throw exception in my processes. This helps me take care of known error scenarios and avoid unexpected process stopping. Check out the below sample process of Handle Exception.

    <?xml version="1.0" encoding="UTF-8"?><process version="9.6.000">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="6.0.002" expanded="true" name="Process" origin="GENERATED_TUTORIAL">
        <parameter key="logverbosity" value="init"/>
        <parameter key="random_seed" value="2001"/>
        <parameter key="send_mail" value="never"/>
        <parameter key="notification_email" value=""/>
        <parameter key="process_duration_for_mail" value="30"/>
        <parameter key="encoding" value="SYSTEM"/>
        <process expanded="true">
          <operator activated="true" breakpoints="after" class="retrieve" compatibility="9.6.000" expanded="true" height="68" name="Iris" origin="GENERATED_TUTORIAL" width="90" x="313" y="30">
            <parameter key="repository_entry" value="//Samples/data/Iris"/>
          </operator>
          <operator activated="true" class="handle_exception" compatibility="9.6.000" expanded="true" height="82" name="Handle Exception" origin="GENERATED_TUTORIAL" width="90" x="514" y="30">
            <parameter key="add_details_to_log" value="false"/>
            <process expanded="true">
              <operator activated="true" class="rename" compatibility="9.6.000" expanded="true" height="76" name="Rename" origin="GENERATED_TUTORIAL" width="90" x="112" y="30">
                <parameter key="old_name" value=""/>
                <list key="rename_additional_attributes">
                  <parameter key="a1" value="att1"/>
                  <parameter key="a2" value="att2"/>
                  <parameter key="a3" value="att3"/>
                  <parameter key="a4" value="att4"/>
                </list>
              </operator>
              <connect from_port="in 1" to_op="Rename" to_port="example set input"/>
              <connect from_op="Rename" from_port="example set output" to_port="out 1"/>
              <portSpacing port="source_in 1" spacing="0"/>
              <portSpacing port="source_in 2" spacing="0"/>
              <portSpacing port="sink_out 1" spacing="0"/>
              <portSpacing port="sink_out 2" spacing="0"/>
            </process>
            <process expanded="true">
              <operator activated="true" class="log" compatibility="9.6.000" expanded="true" height="76" name="Log" origin="GENERATED_TUTORIAL" width="90" x="112" y="30">
                <list key="log">
                  <parameter key="error message" value="operator.Handle Exception.value.exception"/>
                </list>
                <parameter key="sorting_type" value="none"/>
                <parameter key="sorting_k" value="100"/>
                <parameter key="persistent" value="false"/>
              </operator>
              <connect from_port="in 1" to_op="Log" to_port="through 1"/>
              <connect from_op="Log" from_port="through 1" to_port="out 1"/>
              <portSpacing port="source_in 1" spacing="0"/>
              <portSpacing port="source_in 2" spacing="0"/>
              <portSpacing port="sink_out 1" spacing="0"/>
              <portSpacing port="sink_out 2" spacing="0"/>
            </process>
          </operator>
          <connect from_op="Iris" from_port="output" to_op="Handle Exception" to_port="in 1"/>
          <connect from_op="Handle Exception" from_port="out 1" to_port="result 1"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
          <portSpacing port="sink_result 2" spacing="72"/>
        </process>
      </operator>
    </process>
    

    Best,
    Harshit
Sign In or Register to comment.