{"id":13699127,"url":"https://github.com/cockroachdb/django-cockroachdb","last_synced_at":"2025-06-17T09:10:33.169Z","repository":{"id":35236848,"uuid":"191461487","full_name":"cockroachdb/django-cockroachdb","owner":"cockroachdb","description":"CockroachDB Backend for Django","archived":false,"fork":false,"pushed_at":"2025-05-22T20:07:02.000Z","size":330,"stargazers_count":168,"open_issues_count":14,"forks_count":28,"subscribers_count":50,"default_branch":"master","last_synced_at":"2025-06-13T14:02:32.098Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://cockroachlabs.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cockroachdb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-06-11T22:57:38.000Z","updated_at":"2025-06-03T22:50:17.000Z","dependencies_parsed_at":"2024-02-07T21:32:19.100Z","dependency_job_id":"bb14d905-b0ef-4788-9a0b-6437aa162e2c","html_url":"https://github.com/cockroachdb/django-cockroachdb","commit_stats":{"total_commits":241,"total_committers":9,"mean_commits":26.77777777777778,"dds":0.08298755186721996,"last_synced_commit":"3536ebcb28327b4498f9bb33d50b417e0d012c9b"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"purl":"pkg:github/cockroachdb/django-cockroachdb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cockroachdb%2Fdjango-cockroachdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cockroachdb%2Fdjango-cockroachdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cockroachdb%2Fdjango-cockroachdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cockroachdb%2Fdjango-cockroachdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cockroachdb","download_url":"https://codeload.github.com/cockroachdb/django-cockroachdb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cockroachdb%2Fdjango-cockroachdb/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260326793,"owners_count":22992388,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T19:01:02.018Z","updated_at":"2025-06-17T09:10:33.162Z","avatar_url":"https://github.com/cockroachdb.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# CockroachDB backend for Django\n\n## Prerequisites\n\nYou must install:\n\n* [psycopg](https://pypi.org/project/psycopg/), which may have some\n prerequisites [depending on which version you use](https://www.psycopg.org/psycopg3/docs/basic/install.html).\n\nYou can also use either:\n\n* [psycopg2](https://pypi.org/project/psycopg2/), which has some\n  [prerequisites](https://www.psycopg.org/docs/install.html#prerequisites) of\n  its own.\n\n* [psycopg2-binary](https://pypi.org/project/psycopg2-binary/)\n\nThe binary package is a practical choice for development and testing but in\nproduction it is advised to use the package built from sources.\n\n## Install and usage\n\nUse the version of django-cockroachdb that corresponds to your version of\nDjango. For example, to get the latest compatible release for Django 5.2.x:\n\n`pip install django-cockroachdb==5.2.*`\n\nThe minor release number of Django doesn't correspond to the minor release\nnumber of django-cockroachdb. Use the latest minor release of each.\n\nConfigure the Django `DATABASES` setting similar to this:\n\n```python\nDATABASES = {\n    'default': {\n        'ENGINE': 'django_cockroachdb',\n        'NAME': 'django',\n        'USER': 'myprojectuser',\n        'PASSWORD': '',\n        'HOST': 'localhost',\n        'PORT': '26257',\n        # If connecting with SSL, include the section below, replacing the\n        # file paths as appropriate.\n        'OPTIONS': {\n            'sslmode': 'verify-full',\n            'sslrootcert': '/certs/ca.crt',\n            # Either sslcert and sslkey (below) or PASSWORD (above) is\n            # required.\n            'sslcert': '/certs/client.myprojectuser.crt',\n            'sslkey': '/certs/client.myprojectuser.key',\n            # If applicable\n            'options': '--cluster={routing-id}',\n        },\n    },\n}\n```\n\nIf using Kerberos authentication, you can specify a custom service name in\n`'OPTIONS'` using the key `'krbsrvname'`.\n\n## Notes on Django fields\n\n- `IntegerField` uses the same storage as `BigIntegerField` so `IntegerField`\n  is introspected by `inspectdb` as `BigIntegerField`.\n\n- `AutoField` and `BigAutoField` are both stored as\n  [integer](https://www.cockroachlabs.com/docs/stable/int.html) (64-bit) with\n  [`DEFAULT unique_rowid()`](https://www.cockroachlabs.com/docs/stable/functions-and-operators.html#id-generation-functions).\n\n## Notes on Django QuerySets\n\n- [`QuerySet.explain()`](https://docs.djangoproject.com/en/stable/ref/models/querysets/#explain)\n  accepts `verbose`, `types`, `opt`, `vec`, and `distsql` options which\n  correspond to [CockroachDB's parameters](https://www.cockroachlabs.com/docs/stable/explain.html#parameters).\n  For example:\n\n   ```python\n   \u003e\u003e\u003e Choice.objects.explain(opt=True, verbose=True)\n   'scan polls_choice\\n ├── columns: id:1 question_id:4 choice_text:2 votes:3\\n ├── stats: [rows=1]\\n ├── cost: 1.1\\n ├── key: (1)\\n ├── fd: (1)--\u003e(2-4)\\n └── prune: (1-4)'\n   ```\n\n## FAQ\n\n## GIS support\n\nTo use `django.contrib.gis` with CockroachDB, use\n`'ENGINE': 'django_cockroachdb_gis'` in Django's `DATABASES` setting.\n\n## Disabling CockroachDB telemetry\n\nBy default, CockroachDB sends the version of django-cockroachdb that you're\nusing back to Cockroach Labs. To disable this, set\n`DISABLE_COCKROACHDB_TELEMETRY = True` in your Django settings.\n\n## Known issues and limitations in CockroachDB 25.1.x and earlier\n\n- CockroachDB [can't disable constraint checking](https://github.com/cockroachdb/cockroach/issues/19444),\n  which means certain things in Django like forward references in fixtures\n  aren't supported.\n\n- Migrations have some limitations. CockroachDB doesn't support:\n\n   - [changing column type if it's part of an index](https://go.crdb.dev/issue/47636)\n   - dropping or changing a table's primary key\n\n- The `Field.db_comment` and `Meta.db_table_comment` options aren't supported\n  due to [poor performance](https://github.com/cockroachdb/cockroach/issues/95068).\n\n- Unsupported queries:\n   - [Mixed type addition in SELECT](https://github.com/cockroachdb/django-cockroachdb/issues/19):\n     `unsupported binary operator: \u003cint\u003e + \u003cfloat\u003e`\n   - [Division that yields a different type](https://github.com/cockroachdb/django-cockroachdb/issues/21):\n     `unsupported binary operator: \u003cint\u003e / \u003cint\u003e (desired \u003cint\u003e)`\n   - [The power() database function doesn't accept negative exponents](https://github.com/cockroachdb/django-cockroachdb/issues/22):\n     `power(): integer out of range`\n   - [sum() doesn't support arguments of different types](https://github.com/cockroachdb/django-cockroachdb/issues/73):\n      `sum(): unsupported binary operator: \u003cfloat\u003e + \u003cint\u003e`\n   - [greatest() doesn't support arguments of different types](https://github.com/cockroachdb/django-cockroachdb/issues/74):\n     `greatest(): expected \u003carg\u003e to be of type \u003ctype\u003e, found type \u003cother type\u003e`\n   - [`SmallAutoField` generates values that are too large for any corresponding foreign keys](https://github.com/cockroachdb/django-cockroachdb/issues/84).\n\n- GIS:\n   - Some database functions aren't supported: `AsGML`, `AsKML`, `AsSVG`,\n     and `GeometryDistance`.\n   - Some 3D functions or signatures aren't supported: `ST_3DPerimeter`,\n     `ST_3DExtent`, `ST_Scale`, and `ST_LengthSpheroid`.\n   - The `Length` database function isn't supported on geodetic fields:\n     [st_lengthspheroid(): unimplemented](https://github.com/cockroachdb/cockroach/issues/48968).\n   - `Union` may crash with\n     [unknown signature: st_union(geometry, geometry)](https://github.com/cockroachdb/cockroach/issues/49064).\n   - The spheroid argument of ST_DistanceSpheroid\n     [isn't supported](https://github.com/cockroachdb/cockroach/issues/48922):\n     `unknown signature: st_distancespheroid(geometry, geometry, string)`.\n   - These lookups aren't supported:\n     - [contained (@)](https://github.com/cockroachdb/cockroach/issues/56124)\n     - [exact/same_as (~=)](https://github.com/cockroachdb/cockroach/issues/57096)\n     - [left (\u003c\u003c) and right (\u003e\u003e)](https://github.com/cockroachdb/cockroach/issues/57092)\n     - [overlaps_left (\u0026\u003c), overlaps_right (\u0026\u003e), overlaps_above (\u0026\u003c|),\n       overlaps_below (\u0026\u003e|)](https://github.com/cockroachdb/cockroach/issues/57098)\n     - [strictly_above (|\u003e\u003e), strictly_below (\u003c\u003c|)](https://github.com/cockroachdb/cockroach/issues/57095)\n\n## Known issues and limitations in CockroachDB 24.3.x and earlier\n\n- CockroachDB executes `ALTER COLUMN` queries asynchronously which is at\n  odds with Django's assumption that the database is altered before the next\n  migration operation begins. CockroachDB will give an error like\n  `unimplemented: table \u003c...\u003e is currently undergoing a schema change` if a\n  later operation tries to modify the table before the asynchronous query\n  finishes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcockroachdb%2Fdjango-cockroachdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcockroachdb%2Fdjango-cockroachdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcockroachdb%2Fdjango-cockroachdb/lists"}