Skip to content

Commit

Permalink
Update to Django 5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
timgraham committed Dec 24, 2024
1 parent bf408a1 commit deb587f
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: 'timgraham/django'
ref: 'snowflake-5.1.x'
ref: 'snowflake-5.2.x'
path: 'django_repo'
- name: Install system packages for Django's Python test dependencies
run: |
Expand All @@ -43,6 +43,7 @@ jobs:
backends
basic
bulk_create
composite_pk
dates
datetimes
db_functions
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changelog

## 5.1 - 2024-08-14
## 5.2 - Unreleased

Initial release for Django 5.1.x.
Initial release for Django 5.2.x.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
## Install and usage

Use the version of django-snowflake that corresponds to your version of
Django. For example, to get the latest compatible release for Django 5.1.x:
Django. For example, to get the latest compatible release for Django 5.2.x:

`pip install django-snowflake==5.1.*`
`pip install django-snowflake==5.2.*`

The minor release number of Django doesn't correspond to the minor release
number of django-snowflake. Use the latest minor release of each.
Expand Down
2 changes: 1 addition & 1 deletion django_snowflake/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '5.1'
__version__ = '5.2a0'

# Check Django compatibility before other imports which may fail if the
# wrong version of Django is installed.
Expand Down
8 changes: 8 additions & 0 deletions django_snowflake/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ class DatabaseFeatures(BaseDatabaseFeatures):
'bulk_create.tests.BulkCreateTests.test_zero_as_autoval',
# Snowflake returns 'The Name::42.00000'.
'db_functions.text.test_concat.ConcatTests.test_concat_non_str',
# To debug (wrong results):
# https://github.com/django/django/commit/b28438f379049e5ee1a89067e9cc14b7d0da07c
"model_fields.test_jsonfield.TestQuerying.test_lookups_special_chars",
# SQL compilation error: syntax error line 1 at position 279 unexpected 'MODEL_FIELDS_NULLABLEJSONMODEL'.
"model_fields.test_jsonfield.TestQuerying.test_lookups_special_chars_double_quotes",
}

django_test_skips = {
Expand All @@ -176,6 +181,8 @@ class DatabaseFeatures(BaseDatabaseFeatures):
'Snowflake does not enforce UNIQUE constraints.': {
'auth_tests.test_basic.BasicTestCase.test_unicode_username',
'auth_tests.test_migrations.ProxyModelWithSameAppLabelTests.test_migrate_with_existing_target_permission',
'composite_pk.tests.CompositePKTests.test_error_on_comment_pk_conflict',
'composite_pk.tests.CompositePKTests.test_error_on_user_pk_conflict',
'constraints.tests.UniqueConstraintTests.test_database_constraint',
'contenttypes_tests.test_operations.ContentTypeOperationsTests.test_content_type_rename_conflict',
'contenttypes_tests.test_operations.ContentTypeOperationsTests.test_existing_content_type_rename',
Expand Down Expand Up @@ -238,6 +245,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
'expressions.tests.FTimeDeltaTests.test_date_subquery_subtraction',
'expressions.tests.FTimeDeltaTests.test_datetime_subquery_subtraction',
'expressions_window.tests.WindowFunctionTests.test_subquery_row_range_rank',
'foreign_object.test_tuple_lookups.TupleLookupsTests.test_in_subquery',
'lookup.tests.LookupQueryingTests.test_filter_subquery_lhs',
'lookup.tests.LookupTests.test_nested_outerref_lhs',
'model_fields.test_jsonfield.TestQuerying.test_nested_key_transform_on_subquery',
Expand Down
11 changes: 8 additions & 3 deletions django_snowflake/introspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,14 @@ def get_constraints(self, cursor, table_name):
}
# Primary keys
cursor.execute(f'SHOW PRIMARY KEYS IN TABLE {table_name}')
for row in cursor.fetchall():
constraints[self.identifier_converter(row[6])] = {
'columns': [self.identifier_converter(row[4])],
# Sort by key_sequence so columns appear in the correct order.
pk_rows = sorted(cursor.fetchall(), key=lambda row: row[5])
if pk_rows:
columns = [self.identifier_converter(row[4]) for row in pk_rows]
# Constraint names are all the same. Use the first one.
constraint_name = self.identifier_converter(pk_rows[0][6])
constraints[constraint_name] = {
'columns': columns,
'primary_key': True,
'unique': False,
'foreign_key': None,
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ long_description_content_type = text/markdown
classifiers =
Development Status :: 5 - Production/Stable
Framework :: Django
Framework :: Django :: 5.1
Framework :: Django :: 5.2
License :: OSI Approved :: MIT License
Operating System :: OS Independent
Programming Language :: Python
Expand All @@ -27,7 +27,7 @@ project_urls =
python_requires = >=3.10
packages = find:
install_requires =
django >= 5.1, < 5.2
# django >= 5.1, < 5.2
snowflake-connector-python >= 3.6.0

[flake8]
Expand Down

0 comments on commit deb587f

Please sign in to comment.