Skip to content

Commit c87bbcb

Browse files
committed
Fix schema datetime mapping under patched datetime
1 parent 2922cfb commit c87bbcb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

slurm_usage.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
from rich.table import Table
4444

4545
UTC = timezone.utc
46+
# Preserve the original datetime class for type mapping even when patched in tests
47+
_DATETIME_TYPE = datetime
4648

4749
app = typer.Typer(help="SLURM Job Monitor - Collect and analyze job efficiency metrics")
4850
console = Console()
@@ -682,7 +684,7 @@ def get_polars_schema(cls) -> dict[str, pl.DataType]:
682684
float: pl.Float64,
683685
bool: pl.Boolean,
684686
# All datetime fields should be UTC
685-
datetime: pl.Datetime("us", "UTC"),
687+
_DATETIME_TYPE: pl.Datetime("us", "UTC"),
686688
}
687689

688690
schema = {}

0 commit comments

Comments
 (0)