Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hmpf opened this issue Nov 12, 2024 · 1 comment
Labels
data model Affects the data model and/or SQL schema dependencies Run `tox -r` before testing locally, dependencies have changed Django Upgrading to newer versions of Django python Pull requests that update Python code wat Bad things waiting to happen: Bad assumptions, bad design

Comments

@hmpf
Copy link
Contributor

hmpf commented Nov 12, 2024

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...

@hmpf hmpf added python Pull requests that update Python code Django Upgrading to newer versions of Django dependencies Run `tox -r` before testing locally, dependencies have changed data model Affects the data model and/or SQL schema wat Bad things waiting to happen: Bad assumptions, bad design labels Nov 12, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in HTMXify Argus Nov 12, 2024
@elfjes
Copy link
Collaborator

elfjes commented Nov 13, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data model Affects the data model and/or SQL schema dependencies Run `tox -r` before testing locally, dependencies have changed Django Upgrading to newer versions of Django python Pull requests that update Python code wat Bad things waiting to happen: Bad assumptions, bad design
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants