mySQL credentials expression does not loop through all values

Hi,

I am trying to loop through some of my databases so that I would not have to make a mySQL node for every database that I have. I am fetching a list of my databases from Google Sheets. Then I use the fetched list (4 results) to connect to the DB.

The problem is that the node will return 4x the same result, that is from the first database on the list.

Am I doing something wrong or is this a bug?
image



I hope I explained the problem well

Hi @aljaz86, iirc credentials are only loaded once, even if you have multiple items. So to change your credentials used for each item you would need to split the data into batches of 1 and then loop through them, similar to what I have described over here:

Hope this helps! Let me know if you run into any trouble with this.

1 Like

Works like a charm! Thank you!

1 Like

Excellent, thanks so much for confirming!

Maybe I need to open a new thread with a new question but it is semi-related to this. Now I have output in batches and when I merge the data it will give output only of the first batch.

Does this mean I need to loop through each and every further node to get all the results or is there a way around that?

Thank you in advance!

It’ll depend on your exact workflow but I usually place a node like this after my loops that merges all the individual loop executions into a single list of items that’s much easier to work with:

You’d need to update the node name from which to read all items in the Function node. In my example I am reading from a Set node, but your workflow is probably different:

image

With this workflow in place the items coming out of the final Function node behave like they would have without the looping.

1 Like

Wow! Would never have thought of such a set-up! Amazing! Works :smiley:

1 Like