add version identifier to csv

This commit is contained in:
Golumpa 2026-06-17 17:02:40 +01:00
parent 49499f10e3
commit 9b37d0a747
2 changed files with 18 additions and 1 deletions

View file

@ -4,7 +4,10 @@ import csv
from pathlib import Path
from typing import Any
from nte_history_exporter import __version__
FIELDNAMES = [
"exporter_version",
"uid",
"uid_status",
"export_record",
@ -54,4 +57,4 @@ def write_csv(path: str | Path, rows: list[dict[str, Any]]) -> None:
with Path(path).open("w", newline="", encoding="utf-8") as f:
writer = csv.DictWriter(f, fieldnames=FIELDNAMES, extrasaction="ignore")
writer.writeheader()
writer.writerows(rows)
writer.writerows({**row, "exporter_version": __version__} for row in rows)