Skip to content

Commit deb587f

Browse files
committed
Update to Django 5.2
1 parent bf408a1 commit deb587f

File tree

7 files changed

+25
-11
lines changed

7 files changed

+25
-11
lines changed

.github/workflows/tests.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
uses: actions/checkout@v4
1919
with:
2020
repository: 'timgraham/django'
21-
ref: 'snowflake-5.1.x'
21+
ref: 'snowflake-5.2.x'
2222
path: 'django_repo'
2323
- name: Install system packages for Django's Python test dependencies
2424
run: |
@@ -43,6 +43,7 @@ jobs:
4343
backends
4444
basic
4545
bulk_create
46+
composite_pk
4647
dates
4748
datetimes
4849
db_functions

CHANGELOG.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changelog
22

3-
## 5.1 - 2024-08-14
3+
## 5.2 - Unreleased
44

5-
Initial release for Django 5.1.x.
5+
Initial release for Django 5.2.x.

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
## Install and usage
44

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

8-
`pip install django-snowflake==5.1.*`
8+
`pip install django-snowflake==5.2.*`
99

1010
The minor release number of Django doesn't correspond to the minor release
1111
number of django-snowflake. Use the latest minor release of each.

django_snowflake/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = '5.1'
1+
__version__ = '5.2a0'
22

33
# Check Django compatibility before other imports which may fail if the
44
# wrong version of Django is installed.

django_snowflake/features.py

+8
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ class DatabaseFeatures(BaseDatabaseFeatures):
164164
'bulk_create.tests.BulkCreateTests.test_zero_as_autoval',
165165
# Snowflake returns 'The Name::42.00000'.
166166
'db_functions.text.test_concat.ConcatTests.test_concat_non_str',
167+
# To debug (wrong results):
168+
# https://github.com/django/django/commit/b28438f379049e5ee1a89067e9cc14b7d0da07c
169+
"model_fields.test_jsonfield.TestQuerying.test_lookups_special_chars",
170+
# SQL compilation error: syntax error line 1 at position 279 unexpected 'MODEL_FIELDS_NULLABLEJSONMODEL'.
171+
"model_fields.test_jsonfield.TestQuerying.test_lookups_special_chars_double_quotes",
167172
}
168173

169174
django_test_skips = {
@@ -176,6 +181,8 @@ class DatabaseFeatures(BaseDatabaseFeatures):
176181
'Snowflake does not enforce UNIQUE constraints.': {
177182
'auth_tests.test_basic.BasicTestCase.test_unicode_username',
178183
'auth_tests.test_migrations.ProxyModelWithSameAppLabelTests.test_migrate_with_existing_target_permission',
184+
'composite_pk.tests.CompositePKTests.test_error_on_comment_pk_conflict',
185+
'composite_pk.tests.CompositePKTests.test_error_on_user_pk_conflict',
179186
'constraints.tests.UniqueConstraintTests.test_database_constraint',
180187
'contenttypes_tests.test_operations.ContentTypeOperationsTests.test_content_type_rename_conflict',
181188
'contenttypes_tests.test_operations.ContentTypeOperationsTests.test_existing_content_type_rename',
@@ -238,6 +245,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
238245
'expressions.tests.FTimeDeltaTests.test_date_subquery_subtraction',
239246
'expressions.tests.FTimeDeltaTests.test_datetime_subquery_subtraction',
240247
'expressions_window.tests.WindowFunctionTests.test_subquery_row_range_rank',
248+
'foreign_object.test_tuple_lookups.TupleLookupsTests.test_in_subquery',
241249
'lookup.tests.LookupQueryingTests.test_filter_subquery_lhs',
242250
'lookup.tests.LookupTests.test_nested_outerref_lhs',
243251
'model_fields.test_jsonfield.TestQuerying.test_nested_key_transform_on_subquery',

django_snowflake/introspection.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,14 @@ def get_constraints(self, cursor, table_name):
7171
}
7272
# Primary keys
7373
cursor.execute(f'SHOW PRIMARY KEYS IN TABLE {table_name}')
74-
for row in cursor.fetchall():
75-
constraints[self.identifier_converter(row[6])] = {
76-
'columns': [self.identifier_converter(row[4])],
74+
# Sort by key_sequence so columns appear in the correct order.
75+
pk_rows = sorted(cursor.fetchall(), key=lambda row: row[5])
76+
if pk_rows:
77+
columns = [self.identifier_converter(row[4]) for row in pk_rows]
78+
# Constraint names are all the same. Use the first one.
79+
constraint_name = self.identifier_converter(pk_rows[0][6])
80+
constraints[constraint_name] = {
81+
'columns': columns,
7782
'primary_key': True,
7883
'unique': False,
7984
'foreign_key': None,

setup.cfg

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ long_description_content_type = text/markdown
1111
classifiers =
1212
Development Status :: 5 - Production/Stable
1313
Framework :: Django
14-
Framework :: Django :: 5.1
14+
Framework :: Django :: 5.2
1515
License :: OSI Approved :: MIT License
1616
Operating System :: OS Independent
1717
Programming Language :: Python
@@ -27,7 +27,7 @@ project_urls =
2727
python_requires = >=3.10
2828
packages = find:
2929
install_requires =
30-
django >= 5.1, < 5.2
30+
# django >= 5.1, < 5.2
3131
snowflake-connector-python >= 3.6.0
3232

3333
[flake8]

0 commit comments

Comments
 (0)