Closed phillxnet closed 11 months ago
Our existing use of psycopg2 is now one of our older dependencies. Given we are now on the indicated Django 4.2 we have the following constraint re psycopg 3:
https://django.readthedocs.io/en/latest/releases/4.2.html#psycopg-3-support
Psycopg 3 support¶ Django now supports psycopg version 3.1.8 or higher. To update your code, install the psycopg library, you don’t need to change the ENGINE as django.db.backends.postgresql supports both libraries.
Support for psycopg2 is likely to be deprecated and removed at some point in the future.
Be aware that psycopg 3 introduces some breaking changes over psycopg2. As a consequence, you may need to make some changes to account for differences from psycopg2.
Adjusting our pinning to a 3 major version only: "~3" we have the following:
lbuildvm:/opt/rockstor # poetry update
Updating dependencies
Resolving dependencies... (7.9s)
Writing lock file
Package operations: 1 install, 1 update, 1 removal
• Removing psycopg2 (2.8.6)
• Updating certifi (2023.7.22 -> 2023.11.17)
• Installing psycopg (3.1.13)
So we have one incidental update of:
PyPi.org: https://pypi.org/project/certifi/ This is a single release version update:
Our new psycopg (3) has the following, non unique dependencies:
psycopg 3.1.13 PostgreSQL database adapter for Python
├── typing-extensions >=4.1
└── tzdata *
lbuildvm:/opt/rockstor # poetry run python -Wa .venv/bin/django-admin test
Found 0 test(s).
System check identified no issues (0 silenced).
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK
lbuildvm:/opt/rockstor/src/rockstor # poetry run django-admin test -v 2
...
----------------------------------------------------------------------
Ran 278 tests in 40.166s
OK
Destroying test database for alias 'default' ('test_storageadmin')...
Destroying test database for alias 'smart_manager' ('test_smartdb')...
Closing as: Fixed by #2753
As part of our ongoing modernisation, and post our move to Django 4.2, we can adopt the async capable psycopg 3.
This is a requirement for: "Django Server Sent Events to provide live data requirements" #2739
Project Docs: https://www.psycopg.org/psycopg3/docs/
PyPi: https://pypi.org/project/psycopg/ Latest is 3.1.13 Released: Nov 17, 2023
https://www.psycopg.org/psycopg3/docs/basic/install.html#supported-systems
Pure Python installation
https://www.psycopg.org/psycopg3/docs/basic/install.html#pure-python-installation
Differences from psycopg2
https://www.psycopg.org/psycopg3/docs/basic/from_pg2.html#differences-from-psycopg2