Issue with DB Transaction Start and End in a Loop

Hi KNIMErs,

I used the search function of the forum and found some usefull hints. But in my case nothing will fix my problem.

I want to load a lot of data in a SQlite database to do analytics on thte data.
For this front loading process I built this Workflow.

As you can see the Loop End Node crashes with the descriprion “Loop start and end nodes are not in the same workflow”, really?

If I start the DB Connection before the loop is starting I will get another error in my Metanode.


The error message: “Unable to merge flow object stacks: Conflicting FlowObjects: Try-Catch Context vs. <Loop Context (Head 3:23, Tail unassigned)> - iteration 0 (loops/scopes not properly nested?)”

Has anyone an idea what’s going wrong?

Regards,
Brotfahrer

Little update. To place the DB Connector and Transaction very close to the DB Inserter in the Metanode, the first iteration works fine until the Loop End Node.

Encountered loop-end without compatible head! This can be like a “Syntax Error” if some nodes starting in the loop and their connection will stopped/terminated outside the loop. Maybe I’m a little bit blind. Where is the connection which goes outside the loop. I can’t see it.

I also checked my flow variable. There is hint that I loose variables fater disconnect from the database

Regards,
Brotfahrer

Hi @Brotfahrer

Let me take a shot. Add an extra input port (using the 3 dots) to the Loop End node and switch the Loop End node with End If node…

gr. Hans

Hi @HansS ,

Interessting option. Because of the IF Switch the second input port is inactive an then the complete End Loop node is inactive. I tested your solution Table Row to Variable → Active Branche Inverter → Variable to Table Row. Unfortunately I got the same error message “Encountered loop-end without compatible head!”

If the Loop End node looses the connection to the Loop Start node I tried to connect the variable output port from the Table Row to Variable Loop Start node directly to folw variable input port of the Loop End node with the same result. What’s happening with the DB connection and the Flow Variables in a loop?

Regards,
Brotfahrer

Hi @Brotfahrer , I’m not sure specifically, but I would adjust the last workflow screenshot as follows:

Where I have written the two “NoOp” nodes, if you have the NoOp nodes from NodePit Power Nodes (nodes that do nothing but can help structure the flow), then place them at the points indicated by the blue/yellow boxes and attach the flow variables to them.

If you don’t have NoOp nodes, then place an “Add Empty Rows” node at those two points and configure to “add 0 rows” (i.e. do nothing!).

Your workflow currently has portions of the database processing attached regardless of the IF switch branch chosen, whereas you only want that active with the upper branch. This could cause unexpected behaviour when the flow variable from the Connection Closer (which should only operate on the upper IF branch causing the End If to be bypassed and arriving at the Loop End.

By using “noop” (or equivalent) nodes, it better controls the correct flow from the IF Switch.

1 Like

Hi @takbb ,

even the Empty Row Node was not able to fix the Flow Variable flow. I kicked the DB Transaction Start / End nodes. Now the Loop ist working fine.

Thanks all for your help.

Regards,
Brotfahrer

2 Likes

Hi @Brotfahrer ,

had a similar problem in the past with loops and DB Transaction nodes. Not sure if it was fixed, but what you could try is to put the DB transaction nodes inside a component, like described in this thread:

Using DB Transaction inside a loop - KNIME Analytics Platform - KNIME Community Forum

Regards,
David

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.