Skip to content

Commit

Permalink
Add support for Django 4.1
Browse files Browse the repository at this point in the history
    * Strip IDENTITY related suffixes auto fields are getting on Django 4.1.
      These suffixes are upsetting redshift.
  • Loading branch information
fizyk committed Nov 16, 2022
1 parent 3173766 commit 10e698c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ jobs:
max-parallel: 5
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
django-version: ['3.2', '4.0']
django-version: ['3.2', '4.0', '4.1']
exclude:
- django-version: '4.0'
python-version: '3.7'
- django-version: '4.1'
python-version: '3.7'
include:
- django-version: 'main'
python-version: '3.9'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ doc/_build/
coverage.xml
**/.env
examples/**/migrations/*
.idea/
4 changes: 4 additions & 0 deletions django_redshift_backend/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,10 @@ class DatabaseWrapper(BasePGDatabaseWrapper):
data_types = deepcopy(BasePGDatabaseWrapper.data_types)
data_types.update(redshift_data_types)

# Clear suffixes to rid of PostgreSQLs GENERATED BY DEFAULT AS IDENTITY that upset Redshift.
# Takes effect on Django>=4.1. Older version have this attribute empty
data_types_suffix = {}

def __init__(self, *args, **kwargs):
super(DatabaseWrapper, self).__init__(*args, **kwargs)

Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ python =
DJANGO =
3.2: dj32
4.0: dj40
4.1: dj41
main: djmain

[testenv]
Expand Down

0 comments on commit 10e698c

Please sign in to comment.