Skip to main content

CSV Iterator

Purpose

csv_iter reads the next row from a given csv and inject the value every time it is called. For the given csv

NameEmailID
John Doejohn.doe@example.com12345
Jane Smithjane.smith@example.com67890
Alice Johnsonalice.johnson@example.com24680
Bob Brownbob.brown@example.com13579

We'd setup our variables like this

my_csv = file("dataframe:employees.csv") -> csv(hasHeader=True, header="Email")

The dataframe: prefix is a portable filename — it resolves to user data in the Speedscale cloud and to a local workspace file under proxymock/dataframes/ during a local proxymock replay. You can also reference cloud-only user data directly with s3://employees.csv, or use an absolute local path. For files in a subdirectory under proxymock/dataframes/, encode the path separator as __ (e.g. dataframe:employees__data.csv for proxymock/dataframes/employees/data.csv). See the file extractor for the full description of all three forms.

And then when we use it in our transforms we'd get

csv_iter(csv_name="my_csv") -> outputs john.doe@example.com
csv_iter(csv_name="my_csv") -> outputs jane.smith@example.com
csv_iter(csv_name="my_csv") -> outputs alice.johnson@example.com
csv_iter(csv_name="my_csv") -> outputs bob.brown@example.com
# Loops back to the top
csv_iter(csv_name="my_csv") -> outputs john.doe@example.com