https://prefect.io logo
Title
a

Amit Singh

04/30/2020, 3:09 PM
<!here> I'm trying to iterate thru a list received as response from a task but getting this error. How do i resolve it. thanks
TypeError: 'GetItem' object is not iterable
👀 1
a

Avi A

04/30/2020, 3:10 PM
can you share a minimal code example?
a

Amit Singh

04/30/2020, 3:13 PM
with Flow('prepare_for_etl_flow Task') as flow:
	
	athena_tables = get_athena_tablenames(group_code)

	print(type(athena_tables))
	print(athena_tables['data'])
	for athena_tbl in athena_tables['data']:
		print(athena_tbl)
getting the error in for loop
get_athena_tablenames is a task
@Avi A
d

Dylan

04/30/2020, 3:15 PM
Hey Amit, Task results are deferred to run time. If you’d like to iterate over the result of a task, take a look at: https://docs.prefect.io/core/concepts/mapping.html#mapping
👍 1
a

Amit Singh

04/30/2020, 3:52 PM
Thanks @Dylan
d

Dylan

04/30/2020, 3:52 PM
Anytime!