mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +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:
parent
18dcc60efd
commit
f441f672d6
4
.github/workflows/qc_checks.yaml
vendored
4
.github/workflows/qc_checks.yaml
vendored
@ -309,7 +309,7 @@ jobs:
|
|||||||
uses: ./.github/actions/setup
|
uses: ./.github/actions/setup
|
||||||
with:
|
with:
|
||||||
apt-dependency: gettext poppler-utils libpq-dev
|
apt-dependency: gettext poppler-utils libpq-dev
|
||||||
pip-dependency: psycopg2 django-redis>=5.0.0
|
pip-dependency: psycopg django-redis>=5.0.0
|
||||||
dev-install: true
|
dev-install: true
|
||||||
update: true
|
update: true
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
@ -391,7 +391,7 @@ jobs:
|
|||||||
uses: ./.github/actions/setup
|
uses: ./.github/actions/setup
|
||||||
with:
|
with:
|
||||||
apt-dependency: gettext poppler-utils libpq-dev
|
apt-dependency: gettext poppler-utils libpq-dev
|
||||||
pip-dependency: psycopg2
|
pip-dependency: psycopg
|
||||||
dev-install: true
|
dev-install: true
|
||||||
update: true
|
update: true
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
|
@ -571,10 +571,7 @@ db_options = db_config.get('OPTIONS', db_config.get('options', {}))
|
|||||||
|
|
||||||
# Specific options for postgres backend
|
# Specific options for postgres backend
|
||||||
if 'postgres' in db_engine: # pragma: no cover
|
if 'postgres' in db_engine: # pragma: no cover
|
||||||
from psycopg2.extensions import (
|
from django.db.backends.postgresql.psycopg_any import IsolationLevel
|
||||||
ISOLATION_LEVEL_READ_COMMITTED,
|
|
||||||
ISOLATION_LEVEL_SERIALIZABLE,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Connection timeout
|
# Connection timeout
|
||||||
if 'connect_timeout' not in db_options:
|
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
|
'INVENTREE_DB_ISOLATION_SERIALIZABLE', 'database.serializable', False
|
||||||
)
|
)
|
||||||
db_options['isolation_level'] = (
|
db_options['isolation_level'] = (
|
||||||
ISOLATION_LEVEL_SERIALIZABLE
|
IsolationLevel.SERIALIZABLE
|
||||||
if serializable
|
if serializable
|
||||||
else ISOLATION_LEVEL_READ_COMMITTED
|
else IsolationLevel.READ_COMMITTED
|
||||||
)
|
)
|
||||||
|
|
||||||
# Specific options for MySql / MariaDB backend
|
# Specific options for MySql / MariaDB backend
|
||||||
|
@ -159,7 +159,7 @@ grant all privileges on database inventree to myuser;
|
|||||||
The PostgreSQL python binding must also be installed (into your virtual environment):
|
The PostgreSQL python binding must also be installed (into your virtual environment):
|
||||||
|
|
||||||
```
|
```
|
||||||
pip3 install psycopg2 pgcli
|
pip3 install psycopg pgcli
|
||||||
```
|
```
|
||||||
|
|
||||||
### MySQL / MariaDB
|
### MySQL / MariaDB
|
||||||
|
Loading…
Reference in New Issue
Block a user