@@ -40,7 +40,11 @@ def lambda_handler(event, context):
4040 # Number of files to be created
4141 num_files = file_count (s3 .open (input_file , 'r' ), file_delimiter , file_row_limit )
4242 # Split the input file into several files, each with the number of records mentioned in the fileChunkSize parameter.
43- splitFileNames = split (s3 .open (input_file , 'r' ), file_delimiter , file_row_limit , output_file_template ,
43+ splitFileNames = split (input_file ,
44+ s3 .open (input_file , 'r' ),
45+ file_delimiter ,
46+ file_row_limit ,
47+ output_file_template ,
4448 output_path , True ,
4549 num_files )
4650 # Archive the input file.
@@ -65,11 +69,11 @@ def file_count(file_handler, delimiter, row_limit):
6569
6670
6771# Split the input into several smaller files.
68- def split (filehandler , delimiter , row_limit , output_name_template , output_path , keep_headers , num_files ):
72+ def split (input_file , filehandler , delimiter , row_limit , output_name_template , output_path , keep_headers , num_files ):
6973 import csv
7074 reader = csv .reader (filehandler , delimiter = delimiter )
7175 split_file_path = []
72-
76+ data = []
7377 current_piece = 1
7478 current_out_path = os .path .join (
7579 output_path ,
@@ -94,6 +98,8 @@ def split(filehandler, delimiter, row_limit, output_name_template, output_path,
9498 if keep_headers :
9599 current_out_writer .writerow (headers )
96100 current_out_writer .writerow (row )
101+ data .append (row [0 ])
102+ logger .info ("Data" , input_file = input_file , data = data )
97103 return split_file_path
98104
99105
0 commit comments