Not seeing the full result in Logs on the transform task

So, I finished the lab on Airflow Best practices, which introduces 2 DAGS(Simple and Grouped Tasks). Everything works fine as expected, but I decided to be curious to see the Logs to confirm the notifications if it executed the print statements for each of the notification task on each DAG.

The expected format is supposed to follow this print statement below:

print(f"Number of valid records in table {table}: {valid_records}")

But when I check the logs for the notification task, I see something in the print statement that makes me wonder if this is normal since its against a database or is there a way to actually retrieve the value.

This is what I saw in the logs:

2025-01-23, 02:20:58 UTC] {logging_mixin.py:190} INFO - Number of valid records in table payments: LazySelectSequence([1 item])
[2025-01-23, 02:20:58 UTC] {logging_mixin.py:190} INFO - Number of valid records in table customers: LazySelectSequence([1 item])
[2025-01-23, 02:20:58 UTC] {logging_mixin.py:190} INFO - Number of valid records in table products: LazySelectSequence([1 item])
[2025-01-23, 02:20:58 UTC] {python.py:240} INFO - Done. Returned value was: None

What is this “LazySelectSequence([1 item])” , and why is this coming out in the logs, is there a way to get the actual value?

This is the link to the lab:
WEEK4-AIRFLOW_BEST_PRACTICE_LAB

Hello @damolavictor
LazySelectSequence is an object used to reference xcom variables when we have dynamic task mapping. Since airflow doesn’t know how many instances of this variable we have in advance, it saves the variables in a LazySelectSequence list. We can simply get the value from this list by referencing the items within. In this case, we need to change line 72 of the grouped_tasks_dag.py from
print(f"Number of valid records in table {table}: {valid_records}")
to
print(f"Number of valid records in table {table}: {valid_records[0]}")
, and this way the values will be printed out.
Here is the result.


If you want to know more about this concept, you can visit here.
And, thank you for letting us know. I will ask the team to update the instructions.

Thank you for the clarification… glad I was able to bring this up :slight_smile: