2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 13:05:42 +00:00

Switch tests, docs, database settings from psycopg2 to psycopg (#6573)

* Fix isolation_level again, using the recommended method

* Use psycopg instead of psycopg2 in tests, docs
This commit is contained in:
Bobbe
2024-02-26 00:58:32 +01:00
committed by GitHub
parent 18dcc60efd
commit f441f672d6
3 changed files with 6 additions and 9 deletions

View File

@ -571,10 +571,7 @@ db_options = db_config.get('OPTIONS', db_config.get('options', {}))
# Specific options for postgres backend
if 'postgres' in db_engine: # pragma: no cover
from psycopg2.extensions import (
ISOLATION_LEVEL_READ_COMMITTED,
ISOLATION_LEVEL_SERIALIZABLE,
)
from django.db.backends.postgresql.psycopg_any import IsolationLevel
# Connection timeout
if 'connect_timeout' not in db_options:
@ -640,9 +637,9 @@ if 'postgres' in db_engine: # pragma: no cover
'INVENTREE_DB_ISOLATION_SERIALIZABLE', 'database.serializable', False
)
db_options['isolation_level'] = (
ISOLATION_LEVEL_SERIALIZABLE
IsolationLevel.SERIALIZABLE
if serializable
else ISOLATION_LEVEL_READ_COMMITTED
else IsolationLevel.READ_COMMITTED
)
# Specific options for MySql / MariaDB backend