I am trying to read a very large csv file from s3 bucket of row size 100000 each. I am using yield return to return the object when the specific row count is achieved. Then, I'm processing the data and fetching again, then it throws the exception. I did some debugging and saw that if row is not fetched for more than 20 seconds, it is throwing the exception. How, to keep the reader object for longer period of time?
using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture)
{
while(csv.Read())
{
//data insertion to table logic
if(table.Rows.Count == 100000)
{
yield return table;
}
}
}
I am calling this method inside a foreach loop. Also, let me know if there is a way to implement multipart file download from Amazon S3 bucket.
I tried converting the using block to using statement and passing leaveOpen param as true for CsvReader object.