{"id":15295850,"url":"https://github.com/joshtechnologygroup/django-custom-indexes","last_synced_at":"2026-03-07T00:01:46.101Z","repository":{"id":57419617,"uuid":"104385147","full_name":"joshtechnologygroup/django-custom-indexes","owner":"joshtechnologygroup","description":"Django PostgreSQL backend and custom fields to define custom indexes using field attributes.","archived":false,"fork":false,"pushed_at":"2018-12-22T11:32:04.000Z","size":13,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-15T23:50:29.606Z","etag":null,"topics":["db-backend","django","django-application","postgresql","psycopg2-extension","python27"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joshtechnologygroup.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-21T18:38:56.000Z","updated_at":"2025-05-07T09:27:25.000Z","dependencies_parsed_at":"2022-09-07T11:41:29.915Z","dependency_job_id":null,"html_url":"https://github.com/joshtechnologygroup/django-custom-indexes","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/joshtechnologygroup/django-custom-indexes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshtechnologygroup%2Fdjango-custom-indexes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshtechnologygroup%2Fdjango-custom-indexes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshtechnologygroup%2Fdjango-custom-indexes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshtechnologygroup%2Fdjango-custom-indexes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joshtechnologygroup","download_url":"https://codeload.github.com/joshtechnologygroup/django-custom-indexes/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshtechnologygroup%2Fdjango-custom-indexes/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30204109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T19:07:06.838Z","status":"ssl_error","status_checked_at":"2026-03-06T18:57:34.882Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["db-backend","django","django-application","postgresql","psycopg2-extension","python27"],"created_at":"2024-09-30T18:08:24.996Z","updated_at":"2026-03-07T00:01:46.028Z","avatar_url":"https://github.com/joshtechnologygroup.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"django-custom-indexes\n=====================\n\nDjango PostgreSQL backend and custom fields to create custom indexes.\n\nWith this, indexes can be defined for a model using field attributes\nwhich will be migrated to the db, this eliminates the need to write\nmigrations manually with RunSQL to create indexes.\n\nInstallation\n============\n\n[![](https://img.shields.io/pypi/v/django-custom-indexes.svg)](https://pypi.org/project/django-custom-indexes/) [![](https://img.shields.io/badge/Maintained-yes-green.svg)](https://pypi.org/project/django-custom-indexes/) [![](https://img.shields.io/pypi/djversions/django-custom-indexes.svg)](https://pypi.org/project/django-custom-indexes/) [![](https://img.shields.io/pypi/pyversions/django-custom-indexes.svg)](https://pypi.org/project/django-custom-indexes/)\n\n\nThe package can be installed by running the following command:\n\n\n    pip install django-custom-indexes\n\nPyPI: https://pypi.python.org/pypi/django-custom-indexes/\n\nAdd ``django_custom_indexes`` to your ``INSTALLED_APPS``:\n\n\n    INSTALLED_APPS = (\n        '...',\n        'django_custom_indexes'\n    )\n\nRequirements:\n\n-  Django 1.7 to 1.11 (not tested for 2.0+).\n-  PostgreSQL database backend.\n-  Python 2.7\n\nUsage\n=====\n\nCreating Indexes in PostgresSQL:\nhttps://www.postgresql.org/docs/9.5/static/sql-createindex.html\n\nIn your settings update the ``ENGINE`` parameter of ``DATABASES`` to\n``'django_custom_indexes.backends.postgresql_psycopg2'``\n\nBy default custom\\_indexes backend inherits from\ndjango.db.backends.postgresql\\_psycopg2, to use some other sub class of\npostgresql\\_psycopg2 add the following setting:\n\n``DJANGO_CUSTOM_INDEXES_BASE_ENGINE``\n\nExample Usage:\n\n\n    from django_custom_indexes import model_fields\n    from django.db import models\n\n\n    class MyModel(models.Model):\n        my_field1 = model_fields.CustomCharField(\n            max_length=100,\n            custom_indexes=[\n                {\n                    'unique': True, # Optional, used to create unique indexes\n                    'name': 'custom_unique_index', # Optional (auto generated), Required only if no columns are specified\n                    'where': 'my_field2 \u003e 0', # Optional, used to create partial Indexes\n                },\n                {\n                    'unique': True,\n                    'columns': ['lower(my_field1)'], # Optional, Specify columns or expressions for the index\n                }\n            ]\n        )\n        my_field2 = model_fields.CustomIntegerField(\n            custom_indexes=[\n                {\n                    'name': 'custom_gin_index1',\n                    'using': 'USING gin (my_field2)', # Optional, Specify which method to use for the index\n                }\n            ]\n        )\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshtechnologygroup%2Fdjango-custom-indexes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoshtechnologygroup%2Fdjango-custom-indexes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshtechnologygroup%2Fdjango-custom-indexes/lists"}