Uninett / Argus

Argus is an alert aggregator for monitoring systems
GNU General Public License v3.0
19 stars 14 forks source link

We will have to change to psycopg 3.x (from psycopg2 2.x) one day but this has pit falls #942

Open hmpf opened 2 days ago

hmpf commented 2 days ago

I have been trying and failing to test on Python 3.13 + Django 5.1. I couldn't get psycopg(2) to work.

Turns out, psycopg2 is in maintenance mode and Django recommends psycopg 3.1.8+. However, psycopg 3 does not support ±infinity as a value of datetimes, which we use for Incident.end_time (argus.incident.fields.DateTimeInfinityField) and everywhere in NAV.

There is a workaround: https://pypi.org/project/psycopg-infdate/

In order to use psycopg-infdate with Django though I suspect we will have to write our own database backend. BTDT. Maybe not this year...

elfjes commented 1 day ago

Maybe writing a customized DateTimeField could also work and would be simpler?

or not use infinity anymore but explictly use datetime.min and datetime.max since that's what's used under the hood in python anyway