django-cockroachdb 5.0__tar.gz → 5.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. django-cockroachdb-5.2/CHANGELOG.md +6 -0
  2. {django-cockroachdb-5.0/django_cockroachdb.egg-info → django-cockroachdb-5.2}/PKG-INFO +15 -13
  3. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/README.md +12 -9
  4. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/django_cockroachdb/__init__.py +1 -1
  5. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/django_cockroachdb/features.py +83 -29
  6. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/django_cockroachdb/functions.py +3 -1
  7. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/django_cockroachdb/schema.py +6 -2
  8. {django-cockroachdb-5.0 → django-cockroachdb-5.2/django_cockroachdb.egg-info}/PKG-INFO +15 -13
  9. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/django_cockroachdb.egg-info/SOURCES.txt +1 -0
  10. django-cockroachdb-5.2/django_cockroachdb.egg-info/requires.txt +1 -0
  11. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/django_cockroachdb_gis/features.py +11 -0
  12. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/django_cockroachdb_gis/schema.py +1 -1
  13. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/setup.cfg +5 -2
  14. django-cockroachdb-5.0/CHANGELOG.md +0 -5
  15. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/LICENSE +0 -0
  16. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/MANIFEST.in +0 -0
  17. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/django_cockroachdb/base.py +0 -0
  18. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/django_cockroachdb/client.py +0 -0
  19. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/django_cockroachdb/creation.py +0 -0
  20. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/django_cockroachdb/introspection.py +0 -0
  21. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/django_cockroachdb/lookups.py +0 -0
  22. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/django_cockroachdb/operations.py +0 -0
  23. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/django_cockroachdb/utils.py +0 -0
  24. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/django_cockroachdb.egg-info/dependency_links.txt +0 -0
  25. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/django_cockroachdb.egg-info/top_level.txt +0 -0
  26. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/django_cockroachdb_gis/__init__.py +0 -0
  27. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/django_cockroachdb_gis/base.py +0 -0
  28. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/django_cockroachdb_gis/functions.py +0 -0
  29. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/django_cockroachdb_gis/introspection.py +0 -0
  30. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/django_cockroachdb_gis/operations.py +0 -0
  31. {django-cockroachdb-5.0 → django-cockroachdb-5.2}/setup.py +0 -0
@@ -0,0 +1,6 @@
1
+ # Changelog
2
+
3
+ ## 5.2 - 2025-04-07
4
+
5
+ Initial release for Django 5.2.x and CockroachDB 23.2.x, 24.1.x, 24.3.x, and
6
+ 25.1.x.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-cockroachdb
3
- Version: 5.0
3
+ Version: 5.2
4
4
  Summary: Django backend for CockroachDB
5
5
  Home-page: https://github.com/cockroachdb/django-cockroachdb
6
6
  Maintainer: Cockroach Labs
@@ -8,10 +8,9 @@ Maintainer-email: python@cockroachlabs.com
8
8
  License: Apache Software License
9
9
  Project-URL: Source, https://github.com/cockroachdb/django-cockroachdb
10
10
  Project-URL: Tracker, https://github.com/cockroachdb/django-cockroachdb/issues
11
- Platform: UNKNOWN
12
11
  Classifier: Development Status :: 5 - Production/Stable
13
12
  Classifier: Framework :: Django
14
- Classifier: Framework :: Django :: 5.0
13
+ Classifier: Framework :: Django :: 5.2
15
14
  Classifier: License :: OSI Approved :: Apache Software License
16
15
  Classifier: Operating System :: OS Independent
17
16
  Classifier: Programming Language :: Python
@@ -19,9 +18,11 @@ Classifier: Programming Language :: Python :: 3
19
18
  Classifier: Programming Language :: Python :: 3.10
20
19
  Classifier: Programming Language :: Python :: 3.11
21
20
  Classifier: Programming Language :: Python :: 3.12
22
- Requires-Python: >=3.8
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Requires-Python: >=3.10
23
23
  Description-Content-Type: text/markdown
24
24
  License-File: LICENSE
25
+ Requires-Dist: django<6.0,>=5.2
25
26
 
26
27
  # CockroachDB backend for Django
27
28
 
@@ -46,9 +47,9 @@ production it is advised to use the package built from sources.
46
47
  ## Install and usage
47
48
 
48
49
  Use the version of django-cockroachdb that corresponds to your version of
49
- Django. For example, to get the latest compatible release for Django 5.0.x:
50
+ Django. For example, to get the latest compatible release for Django 5.2.x:
50
51
 
51
- `pip install django-cockroachdb==5.0.*`
52
+ `pip install django-cockroachdb==5.2.*`
52
53
 
53
54
  The minor release number of Django doesn't correspond to the minor release
54
55
  number of django-cockroachdb. Use the latest minor release of each.
@@ -117,7 +118,7 @@ By default, CockroachDB sends the version of django-cockroachdb that you're
117
118
  using back to Cockroach Labs. To disable this, set
118
119
  `DISABLE_COCKROACHDB_TELEMETRY = True` in your Django settings.
119
120
 
120
- ## Known issues and limitations in CockroachDB 23.1.x and earlier
121
+ ## Known issues and limitations in CockroachDB 25.1.x and earlier
121
122
 
122
123
  - CockroachDB [can't disable constraint checking](https://github.com/cockroachdb/cockroach/issues/19444),
123
124
  which means certain things in Django like forward references in fixtures
@@ -127,12 +128,6 @@ using back to Cockroach Labs. To disable this, set
127
128
 
128
129
  - [changing column type if it's part of an index](https://go.crdb.dev/issue/47636)
129
130
  - dropping or changing a table's primary key
130
- - CockroachDB executes `ALTER COLUMN` queries asynchronously which is at
131
- odds with Django's assumption that the database is altered before the next
132
- migration operation begins. CockroachDB will give an error like
133
- `unimplemented: table <...> is currently undergoing a schema change` if a
134
- later operation tries to modify the table before the asynchronous query
135
- finishes. A future version of CockroachDB [may fix this](https://github.com/cockroachdb/cockroach/issues/47137).
136
131
 
137
132
  - The `Field.db_comment` and `Meta.db_table_comment` options aren't supported
138
133
  due to [poor performance](https://github.com/cockroachdb/cockroach/issues/95068).
@@ -170,4 +165,11 @@ using back to Cockroach Labs. To disable this, set
170
165
  overlaps_below (&>|)](https://github.com/cockroachdb/cockroach/issues/57098)
171
166
  - [strictly_above (|>>), strictly_below (<<|)](https://github.com/cockroachdb/cockroach/issues/57095)
172
167
 
168
+ ## Known issues and limitations in CockroachDB 24.3.x and earlier
173
169
 
170
+ - CockroachDB executes `ALTER COLUMN` queries asynchronously which is at
171
+ odds with Django's assumption that the database is altered before the next
172
+ migration operation begins. CockroachDB will give an error like
173
+ `unimplemented: table <...> is currently undergoing a schema change` if a
174
+ later operation tries to modify the table before the asynchronous query
175
+ finishes.
@@ -21,9 +21,9 @@ production it is advised to use the package built from sources.
21
21
  ## Install and usage
22
22
 
23
23
  Use the version of django-cockroachdb that corresponds to your version of
24
- Django. For example, to get the latest compatible release for Django 5.0.x:
24
+ Django. For example, to get the latest compatible release for Django 5.2.x:
25
25
 
26
- `pip install django-cockroachdb==5.0.*`
26
+ `pip install django-cockroachdb==5.2.*`
27
27
 
28
28
  The minor release number of Django doesn't correspond to the minor release
29
29
  number of django-cockroachdb. Use the latest minor release of each.
@@ -92,7 +92,7 @@ By default, CockroachDB sends the version of django-cockroachdb that you're
92
92
  using back to Cockroach Labs. To disable this, set
93
93
  `DISABLE_COCKROACHDB_TELEMETRY = True` in your Django settings.
94
94
 
95
- ## Known issues and limitations in CockroachDB 23.1.x and earlier
95
+ ## Known issues and limitations in CockroachDB 25.1.x and earlier
96
96
 
97
97
  - CockroachDB [can't disable constraint checking](https://github.com/cockroachdb/cockroach/issues/19444),
98
98
  which means certain things in Django like forward references in fixtures
@@ -102,12 +102,6 @@ using back to Cockroach Labs. To disable this, set
102
102
 
103
103
  - [changing column type if it's part of an index](https://go.crdb.dev/issue/47636)
104
104
  - dropping or changing a table's primary key
105
- - CockroachDB executes `ALTER COLUMN` queries asynchronously which is at
106
- odds with Django's assumption that the database is altered before the next
107
- migration operation begins. CockroachDB will give an error like
108
- `unimplemented: table <...> is currently undergoing a schema change` if a
109
- later operation tries to modify the table before the asynchronous query
110
- finishes. A future version of CockroachDB [may fix this](https://github.com/cockroachdb/cockroach/issues/47137).
111
105
 
112
106
  - The `Field.db_comment` and `Meta.db_table_comment` options aren't supported
113
107
  due to [poor performance](https://github.com/cockroachdb/cockroach/issues/95068).
@@ -144,3 +138,12 @@ using back to Cockroach Labs. To disable this, set
144
138
  - [overlaps_left (&<), overlaps_right (&>), overlaps_above (&<|),
145
139
  overlaps_below (&>|)](https://github.com/cockroachdb/cockroach/issues/57098)
146
140
  - [strictly_above (|>>), strictly_below (<<|)](https://github.com/cockroachdb/cockroach/issues/57095)
141
+
142
+ ## Known issues and limitations in CockroachDB 24.3.x and earlier
143
+
144
+ - CockroachDB executes `ALTER COLUMN` queries asynchronously which is at
145
+ odds with Django's assumption that the database is altered before the next
146
+ migration operation begins. CockroachDB will give an error like
147
+ `unimplemented: table <...> is currently undergoing a schema change` if a
148
+ later operation tries to modify the table before the asynchronous query
149
+ finishes.
@@ -1,4 +1,4 @@
1
- __version__ = '5.0'
1
+ __version__ = '5.2'
2
2
 
3
3
  # Check Django compatibility before other imports which may fail if the
4
4
  # wrong version of Django is installed.
@@ -5,7 +5,7 @@ from django.utils.functional import cached_property
5
5
 
6
6
 
7
7
  class DatabaseFeatures(PostgresDatabaseFeatures):
8
- minimum_database_version = (22, 1)
8
+ minimum_database_version = (23, 2)
9
9
 
10
10
  # Cloning databases doesn't speed up tests.
11
11
  # https://github.com/cockroachdb/django-cockroachdb/issues/206
@@ -75,6 +75,18 @@ class DatabaseFeatures(PostgresDatabaseFeatures):
75
75
  'virtual': None,
76
76
  }
77
77
 
78
+ @cached_property
79
+ def is_cockroachdb_24_1(self):
80
+ return self.connection.cockroachdb_version >= (24, 1)
81
+
82
+ @cached_property
83
+ def is_cockroachdb_24_3(self):
84
+ return self.connection.cockroachdb_version >= (24, 3)
85
+
86
+ @cached_property
87
+ def is_cockroachdb_25_1(self):
88
+ return self.connection.cockroachdb_version >= (25, 1)
89
+
78
90
  @cached_property
79
91
  def django_test_expected_failures(self):
80
92
  expected_failures = super().django_test_expected_failures
@@ -128,21 +140,24 @@ class DatabaseFeatures(PostgresDatabaseFeatures):
128
140
  'migrations.test_operations.OperationTests.test_alter_field_pk_fk',
129
141
  'migrations.test_operations.OperationTests.test_alter_field_pk_fk_char_to_int',
130
142
  'migrations.test_operations.OperationTests.test_alter_field_pk_fk_db_collation',
131
- 'migrations.test_operations.OperationTests.test_alter_field_reloads_state_on_fk_target_changes',
132
143
  'migrations.test_operations.OperationTests.test_alter_field_reloads_state_fk_with_to_field_related_name_target_type_change', # noqa
133
- 'migrations.test_operations.OperationTests.test_alter_field_reloads_state_on_fk_with_to_field_target_changes', # noqa
134
144
  'migrations.test_operations.OperationTests.test_alter_field_reloads_state_on_fk_with_to_field_target_type_change', # noqa
135
- 'migrations.test_operations.OperationTests.test_rename_field_reloads_state_on_fk_target_changes',
136
145
  'schema.tests.SchemaTests.test_alter_auto_field_to_char_field',
137
146
  'schema.tests.SchemaTests.test_alter_autofield_pk_to_smallautofield_pk',
138
147
  'schema.tests.SchemaTests.test_alter_primary_key_db_collation',
139
- 'schema.tests.SchemaTests.test_alter_primary_key_the_same_name',
140
148
  'schema.tests.SchemaTests.test_char_field_pk_to_auto_field',
141
149
  'schema.tests.SchemaTests.test_char_field_with_db_index_to_fk',
142
150
  'schema.tests.SchemaTests.test_text_field_with_db_index_to_fk',
143
151
  # CockroachDB doesn't support dropping the primary key.
144
152
  'schema.tests.SchemaTests.test_alter_int_pk_to_int_unique',
153
+ # unimplemented: primary key dropped without subsequent addition of
154
+ # new primary key in same transaction
155
+ # https://github.com/cockroachdb/cockroach/issues/48026
156
+ 'migrations.test_operations.OperationTests.test_composite_pk_operations',
145
157
  # CockroachDB doesn't support changing the primary key of table.
158
+ # psycopg.errors.InvalidColumnReference: column "id" is referenced
159
+ # by the primary key
160
+ 'migrations.test_operations.OperationTests.test_alter_id_pk_to_uuid_pk',
146
161
  'schema.tests.SchemaTests.test_alter_not_unique_field_to_primary_key',
147
162
  'schema.tests.SchemaTests.test_primary_key',
148
163
  # SmallAutoField doesn't work:
@@ -154,19 +169,7 @@ class DatabaseFeatures(PostgresDatabaseFeatures):
154
169
  'many_to_one.tests.ManyToOneTests.test_get_prefetch_querysets_reverse_invalid_querysets_length',
155
170
  'migrations.test_operations.OperationTests.test_smallfield_autofield_foreignfield_growth',
156
171
  'migrations.test_operations.OperationTests.test_smallfield_bigautofield_foreignfield_growth',
157
- # unsupported comparison operator: <jsonb> > <string>:
158
- # https://github.com/cockroachdb/cockroach/issues/49144
159
- 'model_fields.test_jsonfield.TestQuerying.test_deep_lookup_transform',
160
- # ordering by JSON isn't supported:
161
- # https://github.com/cockroachdb/cockroach/issues/35706
162
- 'expressions_window.tests.WindowFunctionTests.test_key_transform',
163
- 'model_fields.test_jsonfield.TestQuerying.test_deep_distinct',
164
- 'model_fields.test_jsonfield.TestQuerying.test_order_grouping_custom_decoder',
165
- 'model_fields.test_jsonfield.TestQuerying.test_ordering_by_transform',
166
- 'model_fields.test_jsonfield.TestQuerying.test_ordering_grouping_by_key_transform',
167
- # cannot index a json element:
168
- # https://github.com/cockroachdb/cockroach/issues/35706
169
- 'schema.tests.SchemaTests.test_func_index_json_key_transform',
172
+ 'schema.tests.SchemaTests.test_alter_smallint_pk_to_smallautofield_pk',
170
173
  # unexpected unique index in pg_constraint query:
171
174
  # https://github.com/cockroachdb/cockroach/issues/61098
172
175
  'introspection.tests.IntrospectionTests.test_get_constraints_unique_indexes_orders',
@@ -182,19 +185,44 @@ class DatabaseFeatures(PostgresDatabaseFeatures):
182
185
  # <int> * <int> (desired <decimal>):
183
186
  # https://github.com/cockroachdb/cockroach/issues/73587
184
187
  'aggregation.tests.AggregateTestCase.test_aggregation_default_expression',
185
- # DataError: incompatible COALESCE expressions: expected pi() to be
186
- # of type decimal, found type float
187
- # https://github.com/cockroachdb/cockroach/issues/73587#issuecomment-988408190
188
- 'aggregation.tests.AggregateTestCase.test_aggregation_default_using_decimal_from_database',
189
188
  # ProgrammingError: VALUES types int and float cannot be matched
190
189
  'field_defaults.tests.DefaultTests.test_bulk_create_mixed_db_defaults_function',
191
190
  })
191
+ if not self.is_cockroachdb_24_3:
192
+ expected_failures.update({
193
+ # ALTER COLUMN TYPE requiring rewrite of on-disk data is currently
194
+ # not supported for columns that are part of an index.
195
+ # https://go.crdb.dev/issue/47636
196
+ 'schema.tests.SchemaTests.test_alter_primary_key_the_same_name',
197
+ 'migrations.test_operations.OperationTests.test_alter_field_reloads_state_on_fk_target_changes',
198
+ 'migrations.test_operations.OperationTests.test_alter_field_reloads_state_on_fk_with_to_field_target_changes', # noqa
199
+ 'migrations.test_operations.OperationTests.test_rename_field_reloads_state_on_fk_target_changes',
200
+ # unknown signature: concat(varchar, int) (returning <string>)
201
+ 'migrations.test_operations.OperationTests.test_add_generated_field',
202
+ # concat(): unknown signature: concat(string, int2) (desired <string>)
203
+ 'db_functions.text.test_concat.ConcatTests.test_concat_non_str',
204
+ })
205
+ if self.is_cockroachdb_24_1:
206
+ # USING cast required: https://github.com/cockroachdb/cockroach/issues/82416#issuecomment-2029803229
207
+ expected_failures.update({
208
+ 'schema.tests.SchemaTests.test_alter_text_field_to_date_field',
209
+ 'schema.tests.SchemaTests.test_alter_text_field_to_datetime_field',
210
+ 'schema.tests.SchemaTests.test_alter_text_field_to_time_field',
211
+ })
212
+ if self.is_cockroachdb_25_1:
213
+ expected_failures.update({
214
+ # expected STORED COMPUTED COLUMN expression to have type
215
+ # decimal, but 'pink + pink' has type int
216
+ 'migrations.test_operations.OperationTests.test_generated_field_changes_output_field',
217
+ })
192
218
  if self.uses_server_side_binding:
193
219
  expected_failures.update({
194
220
  # could not determine data type of placeholder:
195
221
  # https://github.com/cockroachdb/cockroach/issues/91396
196
222
  'backends.tests.EscapingChecks.test_parameter_escaping',
197
223
  'backends.tests.EscapingChecksDebug.test_parameter_escaping',
224
+ 'composite_pk.test_update.CompositePKUpdateTests.test_bulk_update_comments',
225
+ 'constraints.tests.CheckConstraintTests.test_database_default',
198
226
  'expressions.tests.BasicExpressionsTests.test_annotate_values_filter',
199
227
  'expressions_case.tests.CaseDocumentationExamples.test_lookup_example',
200
228
  'expressions_case.tests.CaseDocumentationExamples.test_simple_example',
@@ -230,6 +258,10 @@ class DatabaseFeatures(PostgresDatabaseFeatures):
230
258
  'queries.test_bulk_update.BulkUpdateTests.test_updated_rows_when_passing_duplicates',
231
259
  'queries.test_q.QCheckTests.test_expression',
232
260
  'queries.test_qs_combinators.QuerySetSetOperationTests.test_union_multiple_models_with_values_list_and_annotations', # noqa
261
+ # error in argument for $2: could not parse ":" as type int2:
262
+ # strconv.ParseInt: parsing ":": invalid syntax
263
+ # https://github.com/cockroachdb/cockroach/issues/136295
264
+ 'db_functions.text.test_concat.ConcatTests.test_concat_non_str',
233
265
  # unsupported binary operator: <interval> / <decimal>
234
266
  'expressions.tests.FTimeDeltaTests.test_durationfield_multiply_divide',
235
267
  # InvalidParameterValue: unsupported binary operator: <int4> / <float>
@@ -240,6 +272,21 @@ class DatabaseFeatures(PostgresDatabaseFeatures):
240
272
  # operator: <decimal> / <float> (desired <decimal>)
241
273
  'aggregation.tests.AggregateTestCase.test_aggregation_default_passed_another_aggregate',
242
274
  })
275
+ if self.is_cockroachdb_24_3:
276
+ expected_failures.update({
277
+ # psycopg.errors.IndeterminateDatatype: replace():
278
+ # replace(): replace(): concat(): could not determine data
279
+ # type of placeholder $3. This worked until v24.3 added
280
+ # support for non-string data to concat():
281
+ # https://github.com/cockroachdb/cockroach/pull/127098#issuecomment-2492652084
282
+ "model_fields.test_uuid.TestQuerying.test_filter_with_expr",
283
+ })
284
+ if self.is_cockroachdb_25_1:
285
+ expected_failures.update({
286
+ # psycopg.errors.IndeterminateDatatype: could not determine
287
+ # data type of placeholder $1
288
+ 'expressions_case.tests.CaseExpressionTests.test_filter_with_expression_as_condition',
289
+ })
243
290
  else:
244
291
  expected_failures.update({
245
292
  # Unsupported query: unsupported binary operator: <int> / <int>:
@@ -253,13 +300,6 @@ class DatabaseFeatures(PostgresDatabaseFeatures):
253
300
  def django_test_skips(self):
254
301
  skips = super().django_test_skips
255
302
  skips.update({
256
- # https://github.com/cockroachdb/cockroach/issues/47137
257
- # These tests only fail sometimes, e.g.
258
- # https://github.com/cockroachdb/cockroach/issues/65691
259
- 'ALTER COLUMN fails if previous asynchronous ALTER COLUMN has not finished.': {
260
- 'schema.tests.SchemaTests.test_alter_field_db_collation',
261
- 'schema.tests.SchemaTests.test_alter_field_type_and_db_collation',
262
- },
263
303
  # https://github.com/cockroachdb/django-cockroachdb/issues/153#issuecomment-664697963
264
304
  'CockroachDB has more restrictive blocking than other databases.': {
265
305
  'select_for_update.tests.SelectForUpdateTests.test_block',
@@ -285,5 +325,19 @@ class DatabaseFeatures(PostgresDatabaseFeatures):
285
325
  # greater than datetime.timedelta(microseconds=500000)
286
326
  'get_or_create.tests.UpdateOrCreateTransactionTests.test_updates_in_transaction',
287
327
  },
328
+ # https://www.cockroachlabs.com/docs/stable/transaction-retry-error-reference.html#abort_reason_client_reject
329
+ 'Often fails with SerializationFailure: restart transaction: TransactionRetryWithProtoRefreshError': {
330
+ 'admin_views.test_multidb.ViewOnSiteTests.test_contenttype_in_separate_db',
331
+ },
288
332
  })
333
+ if not self.is_cockroachdb_25_1:
334
+ skips.update({
335
+ # https://github.com/cockroachdb/cockroach/issues/47137
336
+ # These tests only fail sometimes, e.g.
337
+ # https://github.com/cockroachdb/cockroach/issues/65691
338
+ 'ALTER COLUMN fails if previous asynchronous ALTER COLUMN has not finished.': {
339
+ 'schema.tests.SchemaTests.test_alter_field_db_collation',
340
+ 'schema.tests.SchemaTests.test_alter_field_type_and_db_collation',
341
+ },
342
+ })
289
343
  return skips
@@ -6,7 +6,8 @@ from django.db.models import (
6
6
  from django.db.models.expressions import When
7
7
  from django.db.models.functions import (
8
8
  ACos, ASin, ATan, ATan2, Cast, Ceil, Coalesce, Collate, Cos, Cot, Degrees,
9
- Exp, Floor, JSONObject, Ln, Log, Radians, Round, Sin, Sqrt, StrIndex, Tan,
9
+ Exp, Floor, JSONArray, JSONObject, Ln, Log, Radians, Round, Sin, Sqrt,
10
+ StrIndex, Tan,
10
11
  )
11
12
 
12
13
 
@@ -76,6 +77,7 @@ def register_functions():
76
77
  func.as_cockroachdb = float_cast
77
78
  Coalesce.as_cockroachdb = coalesce
78
79
  Collate.as_cockroachdb = collate
80
+ JSONArray.as_cockroachdb = JSONArray.as_postgresql
79
81
  JSONObject.as_cockroachdb = JSONObject.as_postgresql
80
82
  Round.as_cockroachdb = round_cast
81
83
  StrIndex.as_cockroachdb = StrIndex.as_postgresql
@@ -55,8 +55,12 @@ class DatabaseSchemaEditor(PostgresDatabaseSchemaEditor):
55
55
  old_db_params, new_db_params, strict=False):
56
56
  # ALTER COLUMN TYPE is experimental.
57
57
  # https://github.com/cockroachdb/cockroach/issues/49329
58
- if (old_type != new_type or
59
- getattr(old_field, 'db_collation', None) != getattr(new_field, 'db_collation', None)):
58
+ if (
59
+ not self.connection.features.is_cockroachdb_25_1 and (
60
+ old_type != new_type or
61
+ getattr(old_field, 'db_collation', None) != getattr(new_field, 'db_collation', None)
62
+ )
63
+ ):
60
64
  self.execute('SET enable_experimental_alter_column_type_general = true')
61
65
  # Skip to the base class to avoid trying to add or drop
62
66
  # PostgreSQL-specific LIKE indexes.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-cockroachdb
3
- Version: 5.0
3
+ Version: 5.2
4
4
  Summary: Django backend for CockroachDB
5
5
  Home-page: https://github.com/cockroachdb/django-cockroachdb
6
6
  Maintainer: Cockroach Labs
@@ -8,10 +8,9 @@ Maintainer-email: python@cockroachlabs.com
8
8
  License: Apache Software License
9
9
  Project-URL: Source, https://github.com/cockroachdb/django-cockroachdb
10
10
  Project-URL: Tracker, https://github.com/cockroachdb/django-cockroachdb/issues
11
- Platform: UNKNOWN
12
11
  Classifier: Development Status :: 5 - Production/Stable
13
12
  Classifier: Framework :: Django
14
- Classifier: Framework :: Django :: 5.0
13
+ Classifier: Framework :: Django :: 5.2
15
14
  Classifier: License :: OSI Approved :: Apache Software License
16
15
  Classifier: Operating System :: OS Independent
17
16
  Classifier: Programming Language :: Python
@@ -19,9 +18,11 @@ Classifier: Programming Language :: Python :: 3
19
18
  Classifier: Programming Language :: Python :: 3.10
20
19
  Classifier: Programming Language :: Python :: 3.11
21
20
  Classifier: Programming Language :: Python :: 3.12
22
- Requires-Python: >=3.8
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Requires-Python: >=3.10
23
23
  Description-Content-Type: text/markdown
24
24
  License-File: LICENSE
25
+ Requires-Dist: django<6.0,>=5.2
25
26
 
26
27
  # CockroachDB backend for Django
27
28
 
@@ -46,9 +47,9 @@ production it is advised to use the package built from sources.
46
47
  ## Install and usage
47
48
 
48
49
  Use the version of django-cockroachdb that corresponds to your version of
49
- Django. For example, to get the latest compatible release for Django 5.0.x:
50
+ Django. For example, to get the latest compatible release for Django 5.2.x:
50
51
 
51
- `pip install django-cockroachdb==5.0.*`
52
+ `pip install django-cockroachdb==5.2.*`
52
53
 
53
54
  The minor release number of Django doesn't correspond to the minor release
54
55
  number of django-cockroachdb. Use the latest minor release of each.
@@ -117,7 +118,7 @@ By default, CockroachDB sends the version of django-cockroachdb that you're
117
118
  using back to Cockroach Labs. To disable this, set
118
119
  `DISABLE_COCKROACHDB_TELEMETRY = True` in your Django settings.
119
120
 
120
- ## Known issues and limitations in CockroachDB 23.1.x and earlier
121
+ ## Known issues and limitations in CockroachDB 25.1.x and earlier
121
122
 
122
123
  - CockroachDB [can't disable constraint checking](https://github.com/cockroachdb/cockroach/issues/19444),
123
124
  which means certain things in Django like forward references in fixtures
@@ -127,12 +128,6 @@ using back to Cockroach Labs. To disable this, set
127
128
 
128
129
  - [changing column type if it's part of an index](https://go.crdb.dev/issue/47636)
129
130
  - dropping or changing a table's primary key
130
- - CockroachDB executes `ALTER COLUMN` queries asynchronously which is at
131
- odds with Django's assumption that the database is altered before the next
132
- migration operation begins. CockroachDB will give an error like
133
- `unimplemented: table <...> is currently undergoing a schema change` if a
134
- later operation tries to modify the table before the asynchronous query
135
- finishes. A future version of CockroachDB [may fix this](https://github.com/cockroachdb/cockroach/issues/47137).
136
131
 
137
132
  - The `Field.db_comment` and `Meta.db_table_comment` options aren't supported
138
133
  due to [poor performance](https://github.com/cockroachdb/cockroach/issues/95068).
@@ -170,4 +165,11 @@ using back to Cockroach Labs. To disable this, set
170
165
  overlaps_below (&>|)](https://github.com/cockroachdb/cockroach/issues/57098)
171
166
  - [strictly_above (|>>), strictly_below (<<|)](https://github.com/cockroachdb/cockroach/issues/57095)
172
167
 
168
+ ## Known issues and limitations in CockroachDB 24.3.x and earlier
173
169
 
170
+ - CockroachDB executes `ALTER COLUMN` queries asynchronously which is at
171
+ odds with Django's assumption that the database is altered before the next
172
+ migration operation begins. CockroachDB will give an error like
173
+ `unimplemented: table <...> is currently undergoing a schema change` if a
174
+ later operation tries to modify the table before the asynchronous query
175
+ finishes.
@@ -18,6 +18,7 @@ django_cockroachdb/utils.py
18
18
  django_cockroachdb.egg-info/PKG-INFO
19
19
  django_cockroachdb.egg-info/SOURCES.txt
20
20
  django_cockroachdb.egg-info/dependency_links.txt
21
+ django_cockroachdb.egg-info/requires.txt
21
22
  django_cockroachdb.egg-info/top_level.txt
22
23
  django_cockroachdb_gis/__init__.py
23
24
  django_cockroachdb_gis/base.py
@@ -0,0 +1 @@
1
+ django<6.0,>=5.2
@@ -1,6 +1,7 @@
1
1
  from django.contrib.gis.db.backends.postgis.features import (
2
2
  DatabaseFeatures as PostGISFeatures,
3
3
  )
4
+ from django.db.backends.postgresql.psycopg_any import is_psycopg3
4
5
  from django.utils.functional import cached_property
5
6
 
6
7
  from django_cockroachdb.features import DatabaseFeatures as CockroachFeatures
@@ -68,10 +69,20 @@ class DatabaseFeatures(CockroachFeatures, PostGISFeatures):
68
69
  # data is currently not supported for columns that are part of an
69
70
  # index: https://github.com/cockroachdb/cockroach/issues/47636
70
71
  'gis_tests.gis_migrations.test_operations.OperationTests.test_alter_geom_field_dim',
72
+ 'gis_tests.gis_migrations.test_operations.OperationTests.test_alter_field_with_spatial_index',
71
73
  # 3D opclass not present on CockroachDB:
72
74
  # https://github.com/cockroachdb/cockroach/issues/47420#issuecomment-969578772
73
75
  'gis_tests.gis_migrations.test_operations.OperationTests.test_add_3d_field_opclass',
74
76
  })
77
+ if is_psycopg3 and not self.is_cockroachdb_24_1:
78
+ expected_failures.update({
79
+ # QuerySet.bulk_create() doesn't work with geometries after
80
+ # https://github.com/django/django/commit/a16eedcf9c69d8a11d94cac1811018c5b996d491
81
+ # could not parse geometry: error parsing EWKB hex: encoding/hex:
82
+ # invalid byte: U+003A ':'
83
+ # https://github.com/cockroachdb/cockroach/issues/138140
84
+ 'gis_tests.geoapp.test_functions.GISFunctionsTests.test_area_lookups',
85
+ })
75
86
  if self.uses_server_side_binding:
76
87
  expected_failures.update({
77
88
  # unknown signature: st_scale(geometry, int, int)
@@ -5,5 +5,5 @@ from django_cockroachdb.schema import (
5
5
  )
6
6
 
7
7
 
8
- class DatabaseSchemaEditor(CockroachSchemaEditor, PostGISSchemaEditor):
8
+ class DatabaseSchemaEditor(PostGISSchemaEditor, CockroachSchemaEditor):
9
9
  pass
@@ -11,7 +11,7 @@ long_description_content_type = text/markdown
11
11
  classifiers =
12
12
  Development Status :: 5 - Production/Stable
13
13
  Framework :: Django
14
- Framework :: Django :: 5.0
14
+ Framework :: Django :: 5.2
15
15
  License :: OSI Approved :: Apache Software License
16
16
  Operating System :: OS Independent
17
17
  Programming Language :: Python
@@ -19,13 +19,16 @@ classifiers =
19
19
  Programming Language :: Python :: 3.10
20
20
  Programming Language :: Python :: 3.11
21
21
  Programming Language :: Python :: 3.12
22
+ Programming Language :: Python :: 3.13
22
23
  project_urls =
23
24
  Source = https://github.com/cockroachdb/django-cockroachdb
24
25
  Tracker = https://github.com/cockroachdb/django-cockroachdb/issues
25
26
 
26
27
  [options]
27
- python_requires = >=3.8
28
+ python_requires = >=3.10
28
29
  packages = find:
30
+ install_requires =
31
+ django >= 5.2, < 6.0
29
32
 
30
33
  [flake8]
31
34
  max-line-length = 119
@@ -1,5 +0,0 @@
1
- # Changelog
2
-
3
- ## 5.0 - 2023-12-11
4
-
5
- Initial release for Django 5.0.x and CockroachDB 22.2.x and 23.1.x.