Options

Loop through database tables

ammarghammargh Member Posts: 27 Maven
edited November 2018 in Help

RM has a "loop data sets" component.

My data sets are saved in a database. Is there is a way to loop through all database tables?

Answers

  • Options
    MartinLiebigMartinLiebig Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,517 RM Data Scientist

    hi,

     

    not with one operator. You can write a SQL statement generating you table of table names and use a Loop Values on it to get each table name as a macro. You can then use this table in the loop.

     

    ~Martin

    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
  • Options
    JEdwardJEdward RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 578 Unicorn

    Yes, you can use the Loop Repository operator and instead of pointing at your local repository point at the //DB/ where your stored connections are. 

    Below is a quick example.

     

    <?xml version="1.0" encoding="UTF-8"?><process version="7.4.000">
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="process" compatibility="7.4.000" expanded="true" name="Process">
    <process expanded="true">
    <operator activated="true" class="loop_repository" compatibility="7.4.000" expanded="true" height="82" name="Loop Repository" width="90" x="179" y="136">
    <parameter key="repository_folder" value="//DB/DemoDataStore/Example Sets/"/>
    <parameter key="entry_type" value="IOObject"/>
    <process expanded="true">
    <connect from_port="repository object" to_port="out 1"/>
    <portSpacing port="source_repository object" spacing="0"/>
    <portSpacing port="source_in 1" spacing="0"/>
    <portSpacing port="sink_out 1" spacing="0"/>
    <portSpacing port="sink_out 2" spacing="0"/>
    </process>
    </operator>
    <connect from_op="Loop Repository" 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="0"/>
    </process>
    </operator>
    </process>
Sign In or Register to comment.