csv_utils
¶
CSV Utility Functions.
Shared CSV operations used by reports and track sync modules.
save_csv
¶
Save the provided data to a CSV file.
Checks if the target directory for the CSV file exists, and creates it if not. Uses atomic write pattern with a temporary file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Sequence[dict[str, str]]
|
List of dictionaries to save to the CSV file. |
required |
fieldnames
|
Sequence[str]
|
List of field names for the CSV file. |
required |
file_path
|
str
|
Path to the CSV file. |
required |
console_logger
|
Logger
|
Logger for console output. |
required |
error_logger
|
Logger
|
Logger for error output. |
required |
data_type
|
str
|
Type of data being saved (e.g., "tracks", "changes report"). |
required |