How to use zip(list_a, list_b) in a loop?

I’m trying to do the following

{% set my_list_a = ['alice', 'bob'] %}
{% set my_list_b = [ref('table_a'), ref('table_b')] %}
{% set my_zip = zip(my_list_a, my_list_b) | list %}
{% for (a, b) in my_zip %}
   do something...
{% endfor %}

But it seems that only the last element was picked up in the loop… Am I using it correctly? TIA!

Hey @topo.lora, it’s hard to know based on your summarised code. I tried using a variant:

{% set my_list_a = ['alice', 'bob'] %}
{% set my_list_b = [2, 3] %}
{% set my_zip = zip(my_list_a, my_list_b) | list %}
{% for (a, b) in my_zip %}
   {{ a }} {{ b }}
{% endfor %}

which compiled to:

   alice 2

   bob 3

which seems to be what you’d expect!

Does ref('table_a') exist? Can you post the code that is in your do something... block?