The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

"Insert and Update a Database"

DayoMDayoM Member Posts: 1 Learner III
edited June 2019 in Help
Hi all,

Forgive me if this is a simple question. I am reading data from a csv file which matches a database table. The primary key of the db is composed of several fields. So far I have not had to much luck with inserting or updating because I get primary key violations. When you setup the file can you setup multiple id's that Match the db?
Tagged:

Answers

  • Nils_WoehlerNils_Woehler Member Posts: 463 Maven
    Hi,

    you can use the update database operator and set the attribute filter type to subset. Then you have to select the attributes your primary key consists of.

    Here is an example:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.3.000">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.3.000" expanded="true" name="Process">
        <process expanded="true" height="190" width="413">
          <operator activated="true" class="retrieve" compatibility="5.3.000" expanded="true" height="60" name="Retrieve" width="90" x="45" y="30">
            <parameter key="repository_entry" value="//Samples/data/Iris"/>
          </operator>
          <operator activated="true" class="update_database" compatibility="5.3.000" expanded="true" height="60" name="Update Database" width="90" x="246" y="30">
            <parameter key="attribute_filter_type" value="subset"/>
            <parameter key="attributes" value="|a1|a2"/>
          </operator>
          <connect from_op="Retrieve" from_port="output" to_op="Update Database" to_port="input"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
        </process>
      </operator>
    </process>
    Best,
    Nils
Sign In or Register to comment.