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

update for Django 5.2 #299

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ jobs:
fail-fast: false
matrix:
include:
- crdb-version: v23.1.27
- crdb-version: v23.1.27
use_psycopg2: psycopg2
- crdb-version: v23.1.27
use_server_side_binding: server_side_binding
- crdb-version: v23.2.12
- crdb-version: v23.2.12
use_psycopg2: psycopg2
Expand Down
10 changes: 3 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Changelog

## 5.1.1 - Unreleased
## 5.2 - Unreleased

- Confirmed support for CockroachDB 24.2.x and 24.3.x (no code changes
required).

## 5.1 - 2024-08-13

Initial release for Django 5.1.x and CockroachDB 23.1.x, 23.2.x, and 24.1.x.
Initial release for Django 5.2.x and CockroachDB 23.2.x, 24.1.x, 24.2.x,
and 24.3.x.
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ production it is advised to use the package built from sources.
## Install and usage

Use the version of django-cockroachdb 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-cockroachdb==5.1.*`
`pip install django-cockroachdb==5.2.*`

The minor release number of Django doesn't correspond to the minor release
number of django-cockroachdb. Use the latest minor release of each.
Expand Down Expand Up @@ -144,7 +144,3 @@ using back to Cockroach Labs. To disable this, set
- [overlaps_left (&<), overlaps_right (&>), overlaps_above (&<|),
overlaps_below (&>|)](https://github.com/cockroachdb/cockroach/issues/57098)
- [strictly_above (|>>), strictly_below (<<|)](https://github.com/cockroachdb/cockroach/issues/57095)

## Known issues and limitations in CockroachDB 23.1.x and earlier

- CockroachDB doesn't support by ordering by JSON.
2 changes: 1 addition & 1 deletion django-test-suite/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ VERSION=$1

# clone django into the repo.
rm -rf _django_repo
git clone --depth 1 --single-branch --branch cockroach-5.1.x https://github.com/timgraham/django _django_repo
git clone --depth 1 --single-branch --branch cockroach-5.2.x https://github.com/timgraham/django _django_repo

# install the django requirements.
cd _django_repo/tests/
Expand Down
2 changes: 1 addition & 1 deletion django_cockroachdb/__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
36 changes: 8 additions & 28 deletions django_cockroachdb/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


class DatabaseFeatures(PostgresDatabaseFeatures):
minimum_database_version = (23, 1)
minimum_database_version = (23, 2)

# Cloning databases doesn't speed up tests.
# https://github.com/cockroachdb/django-cockroachdb/issues/206
Expand Down Expand Up @@ -75,10 +75,6 @@ def introspected_field_types(self):
'virtual': None,
}

@cached_property
def is_cockroachdb_23_2(self):
return self.connection.cockroachdb_version >= (23, 2)

@cached_property
def is_cockroachdb_24_1(self):
return self.connection.cockroachdb_version >= (24, 1)
Expand Down Expand Up @@ -150,6 +146,10 @@ def django_test_expected_failures(self):
'schema.tests.SchemaTests.test_text_field_with_db_index_to_fk',
# CockroachDB doesn't support dropping the primary key.
'schema.tests.SchemaTests.test_alter_int_pk_to_int_unique',
# unimplemented: primary key dropped without subsequent addition of
# new primary key in same transaction
# https://github.com/cockroachdb/cockroach/issues/48026
'migrations.test_operations.OperationTests.test_composite_pk_operations',
# CockroachDB doesn't support changing the primary key of table.
# psycopg.errors.InvalidColumnReference: column "id" is referenced
# by the primary key
Expand All @@ -165,6 +165,7 @@ def django_test_expected_failures(self):
'many_to_one.tests.ManyToOneTests.test_get_prefetch_querysets_reverse_invalid_querysets_length',
'migrations.test_operations.OperationTests.test_smallfield_autofield_foreignfield_growth',
'migrations.test_operations.OperationTests.test_smallfield_bigautofield_foreignfield_growth',
'schema.tests.SchemaTests.test_alter_smallint_pk_to_smallautofield_pk',
# unexpected unique index in pg_constraint query:
# https://github.com/cockroachdb/cockroach/issues/61098
'introspection.tests.IntrospectionTests.test_get_constraints_unique_indexes_orders',
Expand Down Expand Up @@ -193,32 +194,10 @@ def django_test_expected_failures(self):
'migrations.test_operations.OperationTests.test_alter_field_reloads_state_on_fk_with_to_field_target_changes', # noqa
'migrations.test_operations.OperationTests.test_rename_field_reloads_state_on_fk_target_changes',
# unknown signature: concat(varchar, int) (returning <string>)
'migrations.test_operations.OperationTests.test_add_generate_field',
'migrations.test_operations.OperationTests.test_add_generated_field',
# concat(): unknown signature: concat(string, int2) (desired <string>)
'db_functions.text.test_concat.ConcatTests.test_concat_non_str',
})
if not self.is_cockroachdb_23_2:
expected_failures.update({
# cannot index a json element:
# https://github.com/cockroachdb/cockroach/issues/35706
'schema.tests.SchemaTests.test_func_index_json_key_transform',
# ordering by JSON isn't supported:
# https://github.com/cockroachdb/cockroach/issues/35706
'db_functions.comparison.test_json_object.JSONObjectTests.test_order_by_key',
'db_functions.comparison.test_json_object.JSONObjectTests.test_order_by_nested_key',
'expressions_window.tests.WindowFunctionTests.test_key_transform',
'model_fields.test_jsonfield.TestQuerying.test_deep_distinct',
'model_fields.test_jsonfield.TestQuerying.test_order_grouping_custom_decoder',
'model_fields.test_jsonfield.TestQuerying.test_ordering_by_transform',
'model_fields.test_jsonfield.TestQuerying.test_ordering_grouping_by_key_transform',
# unsupported comparison operator: <jsonb> > <string>:
# https://github.com/cockroachdb/cockroach/issues/49144
'model_fields.test_jsonfield.TestQuerying.test_deep_lookup_transform',
# DataError: incompatible COALESCE expressions: expected pi() to be
# of type decimal, found type float
# https://github.com/cockroachdb/cockroach/issues/73587#issuecomment-988408190
'aggregation.tests.AggregateTestCase.test_aggregation_default_using_decimal_from_database',
})
if self.is_cockroachdb_24_1:
# USING cast required: https://github.com/cockroachdb/cockroach/issues/82416#issuecomment-2029803229
expected_failures.update({
Expand All @@ -232,6 +211,7 @@ def django_test_expected_failures(self):
# https://github.com/cockroachdb/cockroach/issues/91396
'backends.tests.EscapingChecks.test_parameter_escaping',
'backends.tests.EscapingChecksDebug.test_parameter_escaping',
'composite_pk.test_update.CompositePKUpdateTests.test_bulk_update_comments',
'constraints.tests.CheckConstraintTests.test_database_default',
'expressions.tests.BasicExpressionsTests.test_annotate_values_filter',
'expressions_case.tests.CaseDocumentationExamples.test_lookup_example',
Expand Down
11 changes: 11 additions & 0 deletions django_cockroachdb_gis/features.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.contrib.gis.db.backends.postgis.features import (
DatabaseFeatures as PostGISFeatures,
)
from django.db.backends.postgresql.psycopg_any import is_psycopg3
from django.utils.functional import cached_property

from django_cockroachdb.features import DatabaseFeatures as CockroachFeatures
Expand Down Expand Up @@ -68,10 +69,20 @@ def django_test_expected_failures(self):
# data is currently not supported for columns that are part of an
# index: https://github.com/cockroachdb/cockroach/issues/47636
'gis_tests.gis_migrations.test_operations.OperationTests.test_alter_geom_field_dim',
'gis_tests.gis_migrations.test_operations.OperationTests.test_alter_field_with_spatial_index',
# 3D opclass not present on CockroachDB:
# https://github.com/cockroachdb/cockroach/issues/47420#issuecomment-969578772
'gis_tests.gis_migrations.test_operations.OperationTests.test_add_3d_field_opclass',
})
if is_psycopg3:
expected_failures.update({
# QuerySet.bulk_create() doesn't work with geometries after
# https://github.com/django/django/commit/a16eedcf9c69d8a11d94cac1811018c5b996d491
# could not parse geometry: error parsing EWKB hex: encoding/hex:
# invalid byte: U+003A ':'
# https://github.com/cockroachdb/cockroach/issues/138140
'gis_tests.geoapp.test_functions.GISFunctionsTests.test_area_lookups',
})
if self.uses_server_side_binding:
expected_failures.update({
# unknown signature: st_scale(geometry, int, int)
Expand Down
2 changes: 1 addition & 1 deletion django_cockroachdb_gis/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
)


class DatabaseSchemaEditor(CockroachSchemaEditor, PostGISSchemaEditor):
class DatabaseSchemaEditor(PostGISSchemaEditor, CockroachSchemaEditor):
pass
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 :: Apache Software 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.2, < 6.0

[flake8]
max-line-length = 119
Expand Down
Loading