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:
@ -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
|
||||
|
Reference in New Issue
Block a user