Skip to main content

Django complementary index definition and management.

Project description

Describe your database index in json files into your apps

Detailed documentation is in the “docs” directory.

Quick start

  1. Add “json_dbindex” to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = (
        ...
        'json_dbindex',
    )
  2. Run python manage.py list_jsindex to list all defined indexes.

Create indexes

Create a file in you app directory called dbindex_create.json with following contents

[{“name”: “django_site_composite_idx”,
“table”: “django_site”,
“columns”: [“domain”,”name”],
“predicat”: “WHERE id > 1000”,
“using”: “btree”,
“database”: “default”,
“unique”: yes},
{“name”: “django_site_name_idx”,
“table”: “django_site”,
“columns”: [{“name”: “gist_trgm_ops”}],
“using”: “gist”,
“extension”: “pg_trgm”}]

Trying to create an existing index will not generate an error, only a logging at level notice will be raised.

Drop indexes

Create a file in you app directory called dbindex_drop.json with following contents.

[{“name”: “django_site_composite_idx”},
{“name”: “django_site_domain_idx”}]

Only the name is required. In the above example two indexes will be dropped. Trying to drop a non existing index will not generate an error, only a logging at level notice will be raised.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-json-dbindex-1.2.3.tar.gz (10.4 kB view details)

Uploaded Source

File details

Details for the file django-json-dbindex-1.2.3.tar.gz.

File metadata

File hashes

Hashes for django-json-dbindex-1.2.3.tar.gz
Algorithm Hash digest
SHA256 fcf0a4f8dde4c552bea98a73817d5f37720a94cc7eaca9d586104bef7cb70380
MD5 887ece40d3c4c74cff1d3281846db7ab
BLAKE2b-256 8449faa22081bbb0154e8d2c470bb13f755b29fe85a660dd2d17cd22ece12c7f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page