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

closes #116: Add support for Django 4.2 #129

Merged
merged 5 commits into from
Jul 22, 2024
Merged

closes #116: Add support for Django 4.2 #129

merged 5 commits into from
Jul 22, 2024

Conversation

shimizukawa
Copy link
Member

@shimizukawa shimizukawa commented Jun 18, 2024

Feature or Bugfix

  • Feature

Purpose

  • Support for Django 4.2

Detail

Relates

TODO

Tasks

Preview Give feedback

@shimizukawa shimizukawa self-assigned this Jun 18, 2024
@shimizukawa shimizukawa changed the title Dj42 closes #116: Add support for Django 4.2 Jun 18, 2024
@shimizukawa
Copy link
Member Author

Now django-redshift-backend maybe works with Django-4.2.
I'm going to test this branch with Redshift database.

@shimizukawa shimizukawa marked this pull request as ready for review June 18, 2024 14:30
@shimizukawa shimizukawa force-pushed the dj42 branch 4 times, most recently from aa064d4 to 6b940cd Compare July 17, 2024 03:42
@shimizukawa
Copy link
Member Author

UnitTest with Redshift has been completed by #134 .
Now testing by django apps under /examples

@shimizukawa
Copy link
Member Author

shimizukawa commented Jul 17, 2024

example/proj1 is ok.

example/dj-sql-explorer raise exception -> issue #135 .
It will be fixed at #136, #137.

@shimizukawa

This comment was marked as outdated.

@shimizukawa
Copy link
Member Author

shimizukawa commented Jul 22, 2024

All tasks have been completed and I have also been able to confirm the operation of the examples/dj-sql-explorer.

install examples/dj-sql-explorer

(venv) @shimizukawa ➜ /workspaces/django-redshift-backend/examples/dj-sql-explorer (dj42) $ uv pip list
Package                     Version     Editable project location
--------------------------- ----------- -----------------------------------
asgiref                     3.8.1
certifi                     2024.7.4
cffi                        1.16.0
charset-normalizer          3.3.2
cryptography                43.0.0
django                      4.2.14
django-appconf              1.0.6
django-cryptography-django5 2.2
django-environ              0.8.1
django-redshift-backend     3.0.1.dev45 /workspaces/django-redshift-backend
django-sql-explorer         5.0.2
idna                        3.7
psycopg2-binary             2.9.9
pycparser                   2.22
python-dateutil             2.9.0.post0
requests                    2.32.3
six                         1.16.0
sqlparse                    0.5.1
typing-extensions           4.12.2
urllib3                     2.2.2

prepare .env copy and modify from .env.sample

before migration

(venv) @shimizukawa ➜ /workspaces/django-redshift-backend/examples/dj-sql-explorer (dj42) $ python manage.py showmigrations
admin
 [ ] 0001_initial
 [ ] 0002_logentry_remove_auto_add
 [ ] 0003_logentry_add_action_flag_choices
auth
 [ ] 0001_initial
 [ ] 0002_alter_permission_name_max_length
 [ ] 0003_alter_user_email_max_length
 [ ] 0004_alter_user_username_opts
 [ ] 0005_alter_user_last_login_null
 [ ] 0006_require_contenttypes_0002
 [ ] 0007_alter_validators_add_error_messages
 [ ] 0008_alter_user_username_max_length
 [ ] 0009_alter_user_last_name_max_length
 [ ] 0010_alter_group_name_max_length
 [ ] 0011_update_proxy_permissions
 [ ] 0012_alter_user_first_name_max_length
contenttypes
 [ ] 0001_initial
 [ ] 0002_remove_content_type_name
explorer
 [ ] 0001_initial
 [ ] 0002_auto_20150501_1515
 [ ] 0003_query_snapshot
 [ ] 0004_querylog_duration
 [ ] 0005_auto_20160105_2052
 [ ] 0006_query_connection
 [ ] 0007_querylog_connection
 [ ] 0008_auto_20190308_1642
 [ ] 0009_auto_20201009_0547
 [ ] 0010_sql_required
 [ ] 0011_query_favorites
 [ ] 0012_alter_queryfavorite_query_alter_queryfavorite_user
 [ ] 0013_querylog_error_querylog_success
 [ ] 0014_promptlog
 [ ] 0015_explorervalue
 [ ] 0016_alter_explorervalue_key
 [ ] 0017_databaseconnection
 [ ] 0018_alter_databaseconnection_host_and_more
 [ ] 0019_alter_databaseconnection_engine
sessions
 [ ] 0001_initial
testapp
 [ ] 0001_initial

migration with redshift

(venv) @shimizukawa ➜ /workspaces/django-redshift-backend/examples/dj-sql-explorer (dj42) $ python manage.py migrate
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, explorer, sessions, testapp
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying auth.0012_alter_user_first_name_max_length... OK
  Applying explorer.0001_initial... OK
  Applying explorer.0002_auto_20150501_1515... OK
  Applying explorer.0003_query_snapshot... OK
  Applying explorer.0004_querylog_duration... OK
  Applying explorer.0005_auto_20160105_2052... OK
  Applying explorer.0006_query_connection... OK
  Applying explorer.0007_querylog_connection... OK
  Applying explorer.0008_auto_20190308_1642... OK
  Applying explorer.0009_auto_20201009_0547... OK
  Applying explorer.0010_sql_required... OK
  Applying explorer.0011_query_favorites... OK
  Applying explorer.0012_alter_queryfavorite_query_alter_queryfavorite_user... OK
  Applying explorer.0013_querylog_error_querylog_success... OK
  Applying explorer.0014_promptlog... OK
  Applying explorer.0015_explorervalue... OK
  Applying explorer.0016_alter_explorervalue_key... OK
  Applying explorer.0017_databaseconnection... OK
  Applying explorer.0018_alter_databaseconnection_host_and_more... OK
  Applying explorer.0019_alter_databaseconnection_engine... OK
  Applying sessions.0001_initial... OK
  Applying testapp.0001_initial... OK

after migration

(venv) @shimizukawa ➜ /workspaces/django-redshift-backend/examples/dj-sql-explorer (dj42) $ python manage.py showmigrations
admin
 [X] 0001_initial
 [X] 0002_logentry_remove_auto_add
 [X] 0003_logentry_add_action_flag_choices
auth
 [X] 0001_initial
 [X] 0002_alter_permission_name_max_length
 [X] 0003_alter_user_email_max_length
 [X] 0004_alter_user_username_opts
 [X] 0005_alter_user_last_login_null
 [X] 0006_require_contenttypes_0002
 [X] 0007_alter_validators_add_error_messages
 [X] 0008_alter_user_username_max_length
 [X] 0009_alter_user_last_name_max_length
 [X] 0010_alter_group_name_max_length
 [X] 0011_update_proxy_permissions
 [X] 0012_alter_user_first_name_max_length
contenttypes
 [X] 0001_initial
 [X] 0002_remove_content_type_name
explorer
 [X] 0001_initial
 [X] 0002_auto_20150501_1515
 [X] 0003_query_snapshot
 [X] 0004_querylog_duration
 [X] 0005_auto_20160105_2052
 [X] 0006_query_connection
 [X] 0007_querylog_connection
 [X] 0008_auto_20190308_1642
 [X] 0009_auto_20201009_0547
 [X] 0010_sql_required
 [X] 0011_query_favorites
 [X] 0012_alter_queryfavorite_query_alter_queryfavorite_user
 [X] 0013_querylog_error_querylog_success
 [X] 0014_promptlog
 [X] 0015_explorervalue
 [X] 0016_alter_explorervalue_key
 [X] 0017_databaseconnection
 [X] 0018_alter_databaseconnection_host_and_more
 [X] 0019_alter_databaseconnection_engine
sessions
 [X] 0001_initial
testapp
 [X] 0001_initial

create superuser

(venv) @shimizukawa ➜ /workspaces/django-redshift-backend/examples/dj-sql-explorer (dj42) $ python manage.py createsup
eruser
Username (leave blank to use 'vscode'): admin
Email address: [email protected]
Password: 
Password (again): 
Superuser created successfully.

runserver

(venv) @shimizukawa ➜ /workspaces/django-redshift-backend/examples/dj-sql-explorer (dj42) $ python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
July 22, 2024 - 21:36:00
Django version 4.2.14, using settings 'config.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

open http://127.0.0.1:8000/explorer

image

So I will merge it shortly.

@shimizukawa shimizukawa merged commit 453f099 into master Jul 22, 2024
34 of 35 checks passed
@shimizukawa shimizukawa deleted the dj42 branch July 22, 2024 21:41
@shimizukawa shimizukawa linked an issue Jul 22, 2024 that may be closed by this pull request
4 tasks
from django.db import DEFAULT_DB_ALIAS, DatabaseError
from django_redshift_backend._vendor.django40.db.backends import utils
from django_redshift_backend._vendor.django40.db.backends.base.validation import BaseDatabaseValidation
from django_redshift_backend._vendor.django40.db.backends.signals import connection_created

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shimizukawa
Creating a separate connection_created signal will break signalling as the original singleton is the one every application depends on

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, thanks! I'll fix it soon.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed the issue by #147

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zsombor-udvardy Thanks for your reporting!
Now fixed django-redshift-backend 4.1.1 has been released.
https://pypi.org/project/django-redshift-backend/4.1.1/

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 Django-4.2 support
2 participants