Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#149 Added a clear message on ImportError when the psycopg2 package cannot be found. #159

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

shimizukawa
Copy link
Member

@shimizukawa shimizukawa commented Sep 29, 2024

Details #150.

As there is no valid way to explicitly depend on psycopg2 at this time, the error message has been made easier to understand.

(venv) @shimizukawa ➜ /tmp/proj $ python
Python 3.8.19 (default, Aug 14 2024, 05:07:38) 
[Clang 18.1.8 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import django_redshift_backend.base
Traceback (most recent call last):
  File "/tmp/proj/venv/lib/python3.8/site-packages/django_redshift_backend/base.py", line 24, in <module>
    from psycopg2.extensions import Binary
ModuleNotFoundError: No module named 'psycopg2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/proj/venv/lib/python3.8/site-packages/django_redshift_backend/base.py", line 26, in <module>
    raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module. Please install as: `pip install django-redshift-backend[psycopg2]` or `pip install django-redshift-backend[psycopg2-binary]`. For more information, see https://django-redshift-backend.readthedocs.io/en/master/basic.html#installation

Error loading psycopg2 module. Please install as: pip install django-redshift-backend[psycopg2]orpip install django-redshift-backend[psycopg2-binary]. For more information, see https://django-redshift-backend.readthedocs.io/en/master/basic.html#installation

@shimizukawa shimizukawa self-assigned this Sep 29, 2024
@shimizukawa shimizukawa changed the base branch from 149-depends-to-psycopg2 to master October 30, 2024 05:16
@shimizukawa shimizukawa marked this pull request as ready for review October 30, 2024 05:17
@shimizukawa shimizukawa merged commit 79bd164 into master Oct 30, 2024
27 of 28 checks passed
@shimizukawa shimizukawa deleted the 149-extra-psycopg2 branch October 30, 2024 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add psycopg support (v3) and remove explicit import of optional dep psycopg2
1 participant