Saravanan666/pypi-org huggingface dataset:
Package: django-postgres-model-constraints
Installation$[sudo]pipinstalldjango-postgres-model-constraintsProsdesigned for Django projects with a large number of models:no needmakemigrationsandmigrateno migration conflictsintegrity checks - drop and create constraints againdefine tables with raw SQL (optional)Examplesfromdjango.appsimportappsfromdjango_postgres_model_constraints.utilsimportget_add_foreign_key_constraint_statements,get_add_unique_constraint_statementsformodelinapps.get_models():statements=get_add_unique_constraint_statements(model)+get_add_foreign_key_constraint_statements(model)fromdjango.appsimportappsfromdjango_postgres_model_constraints.utilsimportget_drop_foreign_key_constraint_statements,get_drop_unique_constraint_statementsformodelinapps.get_models():statements=get_drop_foreign_key_constraint_statements(model)+get_drop_unique_constraint_statements(model)readme42.com
Package: django-postgrespool
This is a simple Postgres Connection Pooling backend for Django 1.4+, powered by the lovely and beautiful SQLAlchemy.UsageUsing Django-PostgresPool is simple, just setdjango_postgrespoolas your connection engine:DATABASES = {
    'default': {
        'ENGINE': 'django_postgrespool'If you’re using thedj-database-urlmodule:import dj_database_url

DATABASES = {'default': dj_database_url.config(engine='django_postgrespool')}If you’re usingsouth:SOUTH_DATABASE_ADAPTERS = {
    'default': 'south.db.postgresql_psycopg2'
}Everything should work as expected.InstallationInstalling Django-PostgresPool is simple, with pip:$ pip install django-postgrespoolConfigurationOptionally, you can provide additional options to pass to SQLAlchemy’s pool creation:DATABASE_POOL_ARGS = {
    'max_overflow': 10,
    'pool_size': 5,
    'recycle': 300
}Here’s a basic explanation of two of these options:pool_size– Theminimumnumber of connections to maintain in the pool.max_overflow– The maximumoverflowsize of the pool. This is not the maximum size of the pool.The total number of “sleeping” connections the pool will allow ispool_size.
The total simultaneous connections the pool will allow ispool_size + max_overflow.As an example, databases in theHeroku Postgresstarter tier have a maximum connection limit of 20. In that case yourpool_sizeandmax_overflow, when combined, should not exceed 20.Check out the officialSQLAlchemy Connection Poolingdocs to learn more about the optoins that can be defined inDATABASE_POOL_ARGS.Django 1.3 Supportdjango-postgrespool currently supports Django 1.4 and greater. Seethis ticketfor 1.3 support.
Package: django-postgrespool2
Django-PostgresPool2This is simple PostgreSQL connection pooling for Django. You can use it as an alternative forPgBouncer.
This is a fork of the originaldjango-postgrespool.InstallationInstalling Django-PostgresPool2 is simple, with pip:$pipinstalldjango-postgrespool2UsageUsing Django-PostgresPool2 is simple, just setdjango_postgrespool2as your connection engine:DATABASES={"default":{"ENGINE":"django_postgrespool2","NAME":"yourdb","USER":"user","PASSWORD":"some_password","HOST":"localhost",}}If you're using theenvironmodule:importenvironenv=environ.Env()DATABASES={"default":env.db("DATABASE_URL",engine="django_postgrespool2")}Everything should work as expected.ConfigurationOptionally, you can provide pool class to construct the pool (defaultsqlalchemy.pool.QueuePool) or additional options to pass to SQLAlchemy's pool creation.
List of possible valuesDATABASE_POOL_CLASSishereDATABASE_POOL_CLASS='sqlalchemy.pool.QueuePool'DATABASE_POOL_ARGS={'max_overflow':10,'pool_size':5,'recycle':300,}Here's a basic explanation of two of these options:pool_size– Theminimumnumber of connections to maintain in the pool.max_overflow– The maximumoverflowsize of the pool. This is not the maximum size of the pool.recycle- Number of seconds between connection recycling, which means upon checkout, if this timeout is surpassed the connection will be closed and replaced with a newly opened connection.The total number of "sleeping" connections the pool will allow ispool_size. The total simultaneous connections the pool will allow ispool_size + max_overflow.As an example, databases in theHeroku Postgresstarter tier have a maximum connection limit of 20. In that case yourpool_sizeandmax_overflow, when combined, should not exceed 20.Check out the officialSQLAlchemy Connection Poolingdocs to learn more about the optoins that can be defined inDATABASE_POOL_ARGS.
Package: django-postgrespool-lab
This is a simple Postgres Connection Pooling backend for Django 1.4+, powered by the lovely and beautiful SQLAlchemy.UsageUsing Django-PostgresPool is simple, just setdjango_postgrespoolas your connection engine:DATABASES = {
    'default': {
        'ENGINE': 'django_postgrespool'If you’re using thedj-database-urlmodule:import dj_database_url

DATABASES['default'] = dj_database_url.config()
DATABASES['default']['ENGINE'] = 'django_postgrespool'If you’re usingsouth:SOUTH_DATABASE_ADAPTERS = {
    'default': 'south.db.postgresql_psycopg2'
}Everything should work as expected.InstallationInstalling Django-PostgresPool is simple, with pip:$ pip install django-postgrespoolConfigurationOptionally, you can provide additional options to pass to SQLAlchemy’s pool creation:DATABASE_POOL_ARGS = {
    'max_overflow': 10,
    'pool_size': 5,
    'recycle': 300
}Here’s a basic explanation of two of these options:pool_size– Theminimumnumber of connections to maintain in the pool.max_overflow– The maximumoverflowsize of the pool. This is not the maximum size of the pool.The total number of “sleeping” connections the pool will allow ispool_size.
The total simultaneous connections the pool will allow ispool_size + max_overflow.As an example, databases in theHeroku Postgresstarter tier have a maximum connection limit of 20. In that case yourpool_sizeandmax_overflow, when combined, should not exceed 20.Check out the officialSQLAlchemy Connection Poolingdocs to learn more about the optoins that can be defined inDATABASE_POOL_ARGS.Django 1.3 Supportdjango-postgrespool currently supports Django 1.4 and greater. Seethis ticketfor 1.3 support.
Package: django-postgres-product
django-postgres-productAdds a product aggregation function to a postgres database and makes it available with djangoUsageAdd the app to your list of installed appsINSTALLED_APPS = [
    ...,
    'postgres_product',
    ...
]Import the product aggregation functionfrom postgres_product import ProductUse the aggregation as described in theDjango DocumentationRoadmapcreate python packaging
Package: django-postgresql-dag
Django & Postgresql-based Directed Acyclic GraphsThe main distinguishing factor for this project is that it can retrieve entire sections of a graph with far
fewer queries than most other packages. The trade off is portability: it uses Postgres' Common Table
Expressions (CTE) to achieve this and is therefore not compatible with other databases.NOTE: Not all methods which would benefit from CTEs use them yet.This project is a work in progress. Again, this project is a work in progress.While functional, it is not yet fully optimized.The primary purpose of this package is tobuildandmanipulateDAGs within a Django project. If you are looking for graphanalysisorvisualization, this may not be the right package.Currently, django-postgresql-dag provides numerous methods for retrieving nodes, and a few for retrieving edges within the graph. In-progress are filters within the CTEs in order to limit the area of the graph to be searched, ability to easily export to NetworkX, and other improvements and utilities.DemoQuickstart exampleInstallpip install django-postgresql-dagWith optional dependencies for using transformations:pip install django-postgresql-dag[transforms]ToDoSee the checklists inissuesto understand the future goals of this project.Credits:This excellent blog postdjango-dagdjango-dag-postgresqldjango-treebeard-dag
Package: django-postgresql-func
Stay tuned for library updates and new releases on our site.py-orm.com/chapter/django-postgresql-func.django-postgresql-func: PostgreSQL Functions and Operators for Django. Full support for classic Django SQL functionsInstallingYou can install or upgrade django-postgresql-func with:$pipinstalldjango-postgresql-func--upgradeOr you can install from source with:$gitclonehttps://github.com/lampofearth/django-postgresql-func--recursive$cddjango-postgresql-func$pythonsetup.pyinstallExamplesdjango-postgresql-func’s examples lives atpy-orm.com/chapter/django-postgresql-func.LicenseYou may copy, distribute and modify the software provided that modifications
are described and licensed for free underLGPL-3.
Derivatives works (including modifications or anything statically linked to the library)
can only be redistributed under LGPL-3, but applications that use the library don’t have to be.
Package: django-postgresql-manager
django-postgresql-managerAuthor:George NotarasDevelopment Web Site:django-postgresql-manager projectSource Code Repository:django-postgresql-manager source codeDocumentation:django-postgresql-manager documentationDownloads:django-postgresql-manager releasesdjango-postgresql-manager is a Django based management interface for PostgreSQL users and databases.Licensed under theApache License version 2.0. More licensing information
exists in thelicensesection.Featuresdjango-postgresql-manager currently supports:User (role) creation/deletion/renaming.Database creation/deletion/renaming.Database ownership changing.Control over the connection limit for users and databases.Marking a user as not active.Multiple PostgreSQL roles and databases per Django user. Each user has
control over the roles and databases it has created.The distribution package includes an example project, which can be used to
demonstrate the application quickly.DocumentationApart from thedjango-postgresql-manager Online Documentation, more information about the
installation, configuration and usage of this application may be available
at the project’swiki.DonationsThis software is released as free-software and provided to you at no cost. However,
a significant amount of time and effort has gone into developing this software
and writing this documentation. So, the production of this software has not
been free from cost. It is highly recommended that, if you use this softwarein production, you should consider making a donation.To make a donation, please visit the CodeTRAXdonations pagewhich contains
aPayPaldonatebutton.Thank you for considering making a donation to django-postgresql-manager.Bugs and feature requestsIn case you run into any problems while using this application or think that
a new feature should be implemented, it is highly recommended yousubmita new
report about it at the project’sissue tracker.Using theissue trackeris the recommended way to notify the authors about
bugs or make feature requests. Also, before submitting a new report, please
make sure you have read thenew issue guidelines.SupportCodeTRAX does not provide support for django-postgresql-manager.You can still get community support at theCommunity Support Forums:LicenseCopyright 2010 George Notaras <gnot [at] g-loaded.eu>Licensed under theApache License, Version 2.0(the “License”);
you may not use this file except in compliance with the License.Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.A copy of the License exists in the product distribution; theLICENSEfile.
For copyright and other important notes regarding this release please read
theNOTICEfile.
Package: django-postgresql-partitioning
Django partitioningDjango partitioning is a package for Django,
which implement PostgreSQLtable partitioningon the fly, at the database level.
It creates several triggers and functions and inserts them directly into the database.
After setup partitioning, record will be inserted into the correct partition,
if partition doesn't exist, it will be created for you automatically.RequirementsDjango >=1.11 <=5.0PostgreSQL >= 8.0Also, notepsycopg2-binary (2.7.5-2.9.9)will be needed as PostgreSQL database adapter.InstallationInstall usingpip...$pipinstalldjango-postgresql-partitioningConfigurationAddpartitioningtoINSTALLED_APPS:INSTALLED_APPS = [
    ...
    partitioning,
]Add partitioning configuration to your models:from partitioning.decorators import partitioning


@partitioning([
    {'type': 'list', 'column': 'tag'},
    {'type': 'range_month', 'column': 'created'},
])
class Message(models.Model):
    text = models.TextField()
    tag = models.CharField(max_length=255)
    created = models.DateTimeField()Lastly setup partitioning:$pythonmanage.pysetup_partitioningapp_nameAvailable settingstype- partition type, currently supported:listrange_dayrange_weekrange_monthrange_yearcolumn- column, used to determine which partition record belongs to.TestingClone the repo:$gitclonehttps://github.com/starnavi-team/django-postgresql-partitioning.gitInstall requirements.$pipinstall-rrequirements.txtUsetoxtesting tool to run the tests against all supported versions of Python and Django. Install tox globally, and then simply run:$tox
Package: django-postgresql-rgb-colorfield
# Django Postgresql RGB ColorFieldThis is a ColorField based on django's `django.contrib.postgres.ArrayField`. Though it shows Hex in admin and let you pick color, it is saving its value as a RGB array. Which is perticularly useful if you want to do query and calculation over it. e.g. Getting colors close to another.### Requirements1. Python 3.X2. Postgresql database in django.### Installation```bashpip install django-postgresql-rgb-colorfield```### Quick start1. Add `colorfield` to your INSTALLED_APPS setting like this:```pythonINSTALLED_APPS = [...'colorfield',]```2. Import and Use `ColorField`:```pythonfrom django.db import modelsfrom colorfield.fields import ColorField# Create your models here.class ColorPallate(models.Model):color1 = ColorField(null=True, blank=True)color2 = ColorField(null=True, blank=True)color3 = ColorField(null=True, blank=True)def __str__(self):return f"Pallate {self.id}"```
Package: django-postgresql-ws
django-postgresql-wsdjango-postgresql-wsis an alternative PostgreSQL backend for Django
proxied over WebSockets. It will only work when configured to run against a
WebSockets proxy that is then communicating with the PostgreSQL server.
websockify is the standard WebSockets proxy service it is tested against.The purpose of this backend is to allow a Django application to run against
a PostgreSQL server in a WebAssembly (Pyodide) environment, where native
sockets are
not allowed but WebSockets are. The WebSocket communication is handled by
the pgwasm library, which itself switches between using a the native
websockets libray when being run in a native environment, and using the
JS-proxied interface when run under Pyodide.This backend is based on a copy of the PostgreSQL backend that
ships with Django 4.1 with updates made to usepgwasminstead ofpsycopg2. Note that while Django does not natively support async in its
implementation of its ORM, the database backend needs to be async in order
to communicate over WebSockets in Pyodide, since the JS interface receives
WebSockets messages via callbacks. Theasync_to_syncmethod provided byasgirefproperly handle running the async methods in the proper event loop.
Package: django-postgres-readonly
A readonly database backend for Django and PostgreSQL. It does this by setting
the connection to “readonly”.UsageTo configure a read-only database connection, add an entry to yourDATABASESsetting that usesdjango_postgres_readonlyas the engine:DATABASES = {
    'default': {
        'NAME': 'my_django_db',
        'ENGINE': 'django.db.backends.postgresql',
        'USER': 'my_db_user',
        'PASSWORD': 'my_password'
    },
    'readonly': {
        'NAME': 'my_django_db',
        'ENGINE': 'django_postgres_readonly',
        'USER': 'my_db_user',
        'PASSWORD': 'my_password'
    }
}CaveatsThis backend is not meant to provide security against willful bad actors. Its
main reason of existence is to protect you against your own mistakes.If you need secure way for read-only connections, you should probably
look into creating a separate user and grant itSELECTrights only.
Package: django-postgres-refresher
Installation$pipinstalldjango-postgres-refreshersettings.pyINSTALLED_APPS+=['django_postgres_refresher']migrate$pythonmanage.pymigrateFeaturesadmin interfacerefresh reports (duration,time) and stat (count,avg_duration,min_duration,max_duration)Examplesrefresh matviewspythonmanage.pypostgres_refresherINSERTtopostgres_refresher_configINSERTINTOpostgres_refresher_config(schemaname,matviewname,"concurrently",seconds)VALUES('schemaname','matviewname',true,600),('schemaname','matviewname2',true,600)ONCONFLICT(schemaname,matviewname)DONOTHING;
Package: django-postgres-refresh-matviews
Installation$[sudo]pipinstalldjango-postgres-refresh-matviewsHow it worksrefresh_pg_matviews- refresh allpg_matviewsmatviewsrefresh_pending_matviews- refreshMatviewmodel matviews:repeat_seconds- seconds interval to refresh matviewis_pending- setTrueto force refreshsettings.pyINSTALLED_APPS+=['django_postgres_refresh_matviews']migrate$pythonmanage.pymigrateExamplesfromdjango_postgres_refresh_matviews.utilsimportrefresh_pg_matviewsrefresh_pg_matviews()fromdjango_postgres_refresh_matviews.modelsimportMatviewfromdjango_postgres_refresh_matviews.utilsimportrefresh_pending_matviewsMatview.objects.get_or_create(schemaname='public',matviewname='matview1')refresh_pending_matviews()Matview.objects.filter(schemaname='public').update(is_pending=False)Logfromdjango_postgres_refresh_matviews.modelsimportLogforlinLog.objects.filter(schemaname='public',matviewname='matview1'):l.started_at,l.completed_atcli$pythonmanage.pyclear_matviews# clear matviews$pythonmanage.pyinit_matviews# init postgres matviews$pythonmanage.pyrefresh_pg_matviews# refresh pg_matviews$pythonmanage.pyrefresh_pending_matviews# refresh pending Matview matviewsraw sqlINSERTINTOrefresh_matview(schemaname,matviewname)SELECTschemaname,matviewnameFROMpg_matviewsONCONFLICT(schemaname,matviewname)DONOTHING;UPDATErefresh_matviewSETis_pending=trueWHEREschemaname='public'ANDmatviewname='matview1';readme42.com
Package: django-postgres-reindex-command
Installation$[sudo]pipinstalldjango-postgres-reindex-commandsettings.pyINSTALLED_APPS=[...'django_postgres_reindex_command',...]Examplesdev$pythonmanage.pyreindexprod$sshuser@hostnamesudodockerrun--env-file.envimagepythonmanage.pyreindexreadme42.com
Package: django-postgres-setfield
A Django field for storingstandard Python setobjects.  It uses Postgres arrays as a backing store.UsageUsing the field is straightforward, and similar to how you’d use aDjango ArrayField.
You can add the field to your model like so:fromdjango.dbimportmodelsfromsetfieldimportSetFieldclassPerson(models.Model):LANGUAGES=(('NL','Dutch'),('EN','English'),('RU','Russian'))speaks_languages=SetField(models.TextField(choices=LANGUAGES),default=list,blank=True)Then later, you can use it:piet=Person(languages={'NL'})piet.save()john=Person(languages={'RU','EN'})john.save()LookupsAll the standardDjango ArrayFieldlookups are supported.CaveatsUnlike ArrayFields, SetFields cannot be nested (because sets cannot
be nested in Python).When upgrading an existing ArrayField to a SetField, make sure the
entries are sorted using the default sort order of Python for the
corresponding object type, if you want to use the__exactlookup.  Otherwise you’ll get inconsistent results.
Package: django-postgres-stats
Django Postgres Stats exposes statistical and datetime functions specific to
Postgres to Django without making the user write raw SQL. The plan is to
expand the library over time to cover many Postgres-specific functions. For
now, only functions personally used by the authors have been added.Detailed documentation is in the “docs” directory.Quick startAdd “postgres_stats” to your INSTALLED_APPS setting like this:INSTALLED_APPS = (
    ...
    'postgres_stats',
)Import the functions you need to use with your models.
Package: django-postgres-tweaks
PostgreSQL lookups and functions for Django appsHow often have you had the impression that Django was not providing all the lookup expressions and
functions for your queries? Probably not that often, but now here is asmallcollection that I
consider quite useful.InstallationJust use:pipinstalldjango-postgres-tweaksAs the title says it already, these tools are designed to be used in Django projects/apps. So make
sure to addpostgres_utilsorpostgres_utils.apps.PostgresUtilsConfigto theINSTALLED_APPSlist in your project'ssettings.py!That's it.UsageLookupsThe lookups provided by this package/app are automatically loaded when the app is installed. You
can go ahead and just use them like Django's built-in lookups, e.g.:Pizza.objects.filter(name__noregex="[ ]+")Assume you have a model calledPizzawith anamefield.FunctionsLike the DB functions provided by Django, e.g. indjango.db.models.functions, you need to need
to import them prior to usage. An example query looks like this:Topping.objects\.filter(name__contains="Onion")\.annotate(onion_color=RegexpReplace("name"," *Onion$",""))\.values("name","onion_color")\.order_by("name")
Package: django-postgres-unlimited-varchar
A tiny app adding support unlimitedvarcharfields (no specified max length) in Django/Postgres.Usage:from django.db import models
from django_postgres_unlimited_varchar import UnlimitedCharField

class Person(models.Model):
    name = UnlimitedCharField()
    ...Why?Out of the box, Django has two fields for text:CharField, which is for single-line text, and has a required maximum length (themax_lengthargument). In the database, this creates a field of typevarchar(LENGTH).TextField, which is for multi-line text, and has no maximum length. In the database, this creates a field of typetext.Clearly missing is a third type: single-line, no max length. Postgres supports this as thevarchartype (note the lack of a length).This field adds that type. AFAIK there isn’t any performance hit in using this, so it’s suitable for any situation where there isn’t a clear required max length.
Package: django-postgres-utils
UtiliUtilities for Django PostgresqlQuickstartInstall Django Postgres Utils:pip install django-postgres-utilsAdd it to yourINSTALLED_APPS:INSTALLED_APPS=(...'django_postgres_utils',...)Sample usage usage ofAdminHStoreWidgetin admin:# admin.pyfromdjango.contribimportadminfromdjango.contrib.postgres.fieldsimportHStoreFieldfromdjango_postgres_utils.widgetsimportAdminHStoreWidget# ...classMyModelAdmin(admin.ModelAdmin):formfield_overrides={HStoreField:{'widget':AdminHStoreWidget},}# ...FeaturesUser friendly Admin widget for django HStoreField;django_postgres_utils.widgets.AdminHStoreWidgetRunning TestsDoes the code actually work?source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ toxCreditsTools used in rendering this package:Cookiecuttercookiecutter-djangopackageHistory0.1.0 (2017-09-18)First release on PyPI.0.1.1 (2018-10-03)Upgrade to underscore 1.9.1Fix bug in displaying quoted values0.1.2 (2018-11-20)Django 2.1 compatibility
Package: django-postgres-vacuum
Installation$[sudo]pipinstalldjango-postgres-vacuumsettings.pyINSTALLED_APPS+=['django_postgres_vacuum']Examplesfromdjango.core.managementimportcall_commandcall_command('vacuum')call_command('vacuum_full')$pythonmanage.pyvacuum
$pythonmanage.pyvacuum_fullreadme42.com