@@ -18,16 +18,19 @@ def export_to_file(
1818 return ""
1919
2020 full_name = f"{ filename } .{ file_type } "
21- if file_type in ["csv" , "xlsx" ]:
21+ if file_type in ["csv" , "xlsx" , "parquet" ]:
2222 writer = convert_to_dataframe (facilities_data ["facilities" ])
23- if file_type == "xlsx" :
24- with xlsxwriter .Workbook (full_name , {"remove_timezone" : True }) as wb :
25- writer .write_excel (workbook = wb , include_header = True , autofit = True )
26- elif file_type == "csv" :
27- with open (full_name , "w" , newline = "" , encoding = "utf-8" ) as f_out :
28- writer .write_csv (file = f_out , include_header = True )
23+ match file_type :
24+ case "xlsx" :
25+ with xlsxwriter .Workbook (full_name , {"remove_timezone" : True }) as wb :
26+ writer .write_excel (workbook = wb , include_header = True , autofit = True )
27+ case "csv" :
28+ with open (full_name , "w" , newline = "" , encoding = "utf-8" ) as f_out :
29+ writer .write_csv (file = f_out , include_header = True )
30+ case "parquet" :
31+ writer .write_parquet (full_name , use_pyarrow = True )
2932 elif file_type == "json" :
30- with open (full_name , "w" , newline = "" , encoding = "utf-8" ) as f_out :
33+ with open (full_name , "w" , encoding = "utf-8" ) as f_out :
3134 json .dump (facilities_data , f_out , indent = 2 , sort_keys = True , default = str )
3235
3336 logger .info (
0 commit comments