Package: django-postgres-extra-kauffman
QualityTest coverageLicensePyPiDjango versions>=1.11 (including 2.0)Python versions>=3.5django-postgres-extraaims to make all of PostgreSQL’s awesome features available through the Django ORM. We do this by taking care of all the hassle. As opposed to the many small packages that are available to try to bring a single feature to Django with minimal effort.django-postgres-extragoes the extra mile, with well tested implementations, seamless migrations and much more.With seamless we mean that any features we add will work truly seamlessly. You should not have to manually modify your migrations to work with fields and objects provided by this package.DocumentationReadTheDocs HTMLhttp://django-postgres-extra.readthedocs.ioPlain MarkDownhttps://github.com/SectorLabs/django-postgres-extra/tree/master/docsMajor featuresNative upsertsSingle queryConcurrency safeWith bulk support (single query)Extended support for HStoreFieldUnique constraintsNull constraintsSelect individual keys using.values()or.values_list()Extra signalsUpdatesExtra expressionsMINandMAXfor multiple value fields such as hstore and array.IndexesCustom indexes with conditions.Desired/future featuresDesired enhancementsInstallationInstall the package from PyPi:λpipinstalldjango-postgres-extraAddpostgres_extraanddjango.contrib.postgresto yourINSTALLED_APPS:INSTALLED_APPS=[....'django.contrib.postgres','psqlextra']Set the database engine topsqlextra.backend:DATABASES={'default':{...'ENGINE':'psqlextra.backend'}}Make sure all models that inherit frompsqlextra.models.PostgresModelor use thepsqlextra.manager.PostgresManager. Without this, most featuresdo not work.FAQ - Frequently asked questionsWhy do I need to change the database back-end/engine?We utilize PostgreSQL’shstoredata type, which allows you to store key-value pairs in a column.  In order to createUNIQUEconstraints on specific key, we need to create a special type of index. We could do this without a custom database back-end, but it would require everyone to manually write their migrations. By using a custom database back-end, we added support for this. When changing theuniquenessconstraint on aHStoreField, our custom database back-end takes care of creating, updating and deleting these constraints/indexes in the database.I am already using a custom database back-end, can I still use yours?Yes. You can set thePOSTGRES_EXTRA_DB_BACKEND_BASEsetting to your current back-end. This will instruct our custom database back-end to inherit from the database back-end you specified.Warning: this will only work if the base you specified indirectly inherits from the standard PostgreSQL database back-end.Does this package work with Python 2?No. Only Python 3.5 or newer is supported. We’re using type hints. These do not work well under older versions of Python.Which Django versions does this package work with?Django 1.11 or newer (that includes Django 2.0).Working with the codePrerequisitesPostgreSQL 9.6 or newer.Django 1.11 or newer.Python 3.5 or newer.Getting startedClone the repository:λgitclonehttps://github.com/SectorLabs/django-postgres-extra.gitCreate a virtual environment:λcddjango-postgres-extraλvirtualenvenvλsourceenv/bin/activateCreate a postgres user for use in tests (skip if your default user is a postgres superuser):λcreateuser--superuserpsqlextra--pwpromptλexportDATABASE_URL=postgres://psqlextra:<password>@localhost/psqlextraHint: if you’re using virtualenvwrapper, you might find it beneficial to put
theexportline in$VIRTUAL_ENV/bin/postactivateso that it’s always
available when using this virtualenv.Install the development/test dependencies:λpipinstall-rrequirements/test.txtRun the tests:λtoxRun the benchmarks:λpy.test-cpytest-benchmark.ini