Skip to content

Commit

Permalink
django-redshift-backend depends directly on psycopg2. #149
Browse files Browse the repository at this point in the history
  • Loading branch information
shimizukawa committed Sep 16, 2024
1 parent 3697dfe commit e04bce2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ CHANGES
4.2.0 (Unreleased)
------------------

General:

* #149 django-redshift-backend depends directly on psycopg2.
If you want to use psycopg2 pre-built packages, please refer to
the following site for more information:
https://www.psycopg.org/docs/install.html

Features:

* #143 Add Django-5.0 support.
Expand Down
10 changes: 7 additions & 3 deletions django_redshift_backend/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import django
from django.utils import timezone
from django.conf import settings
from django.core.exceptions import FieldDoesNotExist
from django.core.exceptions import FieldDoesNotExist, ImproperlyConfigured
from django.db.models import Index
from django.db.models.expressions import Col
from django.db.utils import NotSupportedError, ProgrammingError
Expand All @@ -37,9 +37,13 @@
DatabaseIntrospection as BasePGDatabaseIntrospection,
)
from .meta import DistKey, SortKey
from psycopg2.extensions import Binary

from .psycopg2adapter import RedshiftBinary
try:
from psycopg2.extensions import Binary
from .psycopg2adapter import RedshiftBinary
except ImportError as e:
raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)


logger = logging.getLogger("django.db.backends")

Expand Down
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@ classifiers = [
]
dependencies = [
"django<5.2",
"psycopg2",
"backports.zoneinfo;python_version<'3.9'",
]

[project.optional-dependencies]
psycopg2 = [
"psycopg2",
]
psycopg2-binary = [
"psycopg2-binary",
]
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ DJANGO =
[testenv]
deps =
coverage
psycopg2-binary>=2.7
pytest
pytest-cov
mock>=2.0
Expand All @@ -41,6 +40,7 @@ deps =
dj50: Django>=5.0,<5.1
dj51: Django>=5.1,<5.2
djmain: https://github.com/django/django/archive/main.tar.gz
.[psycopg2-binary]
setenv =
DJANGO_SETTINGS_MODULE = settings
PYTHONPATH = {toxinidir}
Expand Down

0 comments on commit e04bce2

Please sign in to comment.