How to do a dynamic insert into a table?

Support/help with CloverETL implementation problems

Posts: 9
Joined: Thu Feb 09, 2017 2:59 pm

How to do a dynamic insert into a table?

Postby PBizme » Fri Feb 10, 2017 2:36 pm

I've got a subgraph set up that takes in a table name parameter. My goal is to select the data from that table in my Oracle system and insert it into a table with the same structure which already exists in Azure. I want this subgraph to be able to work with many different tables.

Currently I have this working except that instead of inserting into the Azure table I'm just writing out a CSV. I haven't been able to figure out how to use DBOutputTable dynamically. Is there a way to do this using DBOutputTable and avoid writing the CSV? Do I have to do it by writing out the CSV first and then loading that file using a different component instead?

Posts: 20
Joined: Fri Nov 04, 2016 8:51 am

Re: How to do a dynamic insert into a table?

Postby jandikovae » Wed Feb 15, 2017 11:49 am


This answer is also a reaction to forum ticket How to set a parameter on subgraph.

Just to give you the background on this. The subgraph does not actually work as a loop. It just behaves as any kind of component, therefore as Lukas noted in the topic mentioned above, you cannot actually use a different parameter for each subgraph run (as the subgraph is initialized just once at the beginning).

What you are trying to handle is, however, possible with so-called Jobflows. Let me explain that step by step.

1. In your current (not dynamic) graph, what you can do is to set a Parameter e.g. PARAM that holds a table name. In a DBOutputTable component, you can then set DB Connection property and then DB table property to be something like ${PARAM}.
This setup means that the data is going to be loaded to the database (connection tells us the right database) and table (parameter holds the name of the table).

2. Then you can create a Jobflow. CloverETL Jobflow module allows combining graphs and lets you also create the loop desired. Please note that execution of Jobflow requires CloverETL Server Corporate environment. For more information see:

In the Jobflow you can use a component called ExecuteGraph. You can connect a list of table names to the input 0 of the ExecuteGraph and then map the field to the parameter PARAM created in your original graph. Please note that the parameter PARAM is available in Input Mapping editor only if you have the original graph already selected in the Graph URL property of the ExecuteGraph component.

3. I am not sure from your question if these tables that you are trying to migrate this way do have the same metadata. If not, you should create dynamic metadata as well. You can do it by following:
Create a connection to your database in the original graph.
Go to the Source tab (an extra tab below the Graph pane) and add the following link to the <Global> section of the code:

Code: Select all

<Metadata connection="JDBC0" id="Metadata-dyn" name="dynmet" sqlQuery="SELECT * FROM ${PARAM} LIMIT 1"/>

If you then click back to the Graph pane, you can see a newly created Metadata called "dynmet" in the Outline. You can use this metadata as usual (e.g. drag and drop it to the right edge). As you've probably already found out, it means that each time the graph starts (each time the Jobflow executes the graph), it runs the SELECT query using the PARAM value (which is the table name) and creates the appropriate metadata.

I hope that my explanation is understandable, if you have any question though, please let us know.

Eva Jandikova
CloverCARE Support
CloverETL | Rapid Data Integration

Visit us online at
How to speed up communication with CloverCARE support

Posts: 9
Joined: Thu Feb 09, 2017 2:59 pm

Re: How to do a dynamic insert into a table?

Postby PBizme » Wed Feb 15, 2017 4:02 pm

I actually had a call yesterday with Clover and determined that part of my issue is that I need the Server version of the software to use jobflows and use parameters in graphs. I was basically trying to do the same thing with graphs and subgraphs. I'm expecting to get a trial of Server which will hopefully resolve many of my issues.

Posts: 25
Joined: Wed Nov 09, 2016 11:51 pm
Location: 2111 Wilson Blvd., Arlington VA 22201

Re: How to do a dynamic insert into a table?

Postby svecp » Sun Feb 19, 2017 3:23 pm

Great read. Please feel free to shoot myself and/or Kevin an email if you'd get stuck, so we can get you up to speed faster. Would you like to send that graph and jobflow we sketched out before?
Pavel Švec | CloverETL | Sales Engineer | 2111 Wilson Blvd | Suite 320 | Arlington, VA 22201