{"id":18763769,"url":"https://github.com/roverdotcom/django-delayed-union","last_synced_at":"2025-04-13T04:32:50.780Z","repository":{"id":45046741,"uuid":"125865370","full_name":"roverdotcom/django-delayed-union","owner":"roverdotcom","description":"A library designed to workaround some drawbacks with Django's union, intersection, and difference operations.","archived":false,"fork":false,"pushed_at":"2022-01-12T19:09:55.000Z","size":82,"stargazers_count":9,"open_issues_count":2,"forks_count":3,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-26T21:46:06.703Z","etag":null,"topics":[],"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/roverdotcom.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-19T13:52:27.000Z","updated_at":"2024-02-20T17:09:40.000Z","dependencies_parsed_at":"2022-09-26T19:00:23.814Z","dependency_job_id":null,"html_url":"https://github.com/roverdotcom/django-delayed-union","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roverdotcom%2Fdjango-delayed-union","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roverdotcom%2Fdjango-delayed-union/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roverdotcom%2Fdjango-delayed-union/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roverdotcom%2Fdjango-delayed-union/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roverdotcom","download_url":"https://codeload.github.com/roverdotcom/django-delayed-union/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248557853,"owners_count":21124164,"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-11-07T18:27:23.794Z","updated_at":"2025-04-13T04:32:50.552Z","avatar_url":"https://github.com/roverdotcom.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"========\nOverview\n========\n\n.. start-badges\n\n.. list-table::\n    :stub-columns: 1\n\n    * - docs\n      - |docs|\n    * - tests\n      - | |travis|\n        | |codecov|\n    * - package\n      - | |version| |wheel| |django-versions| |supported-versions|\n        | |commits-since|\n\n.. |docs| image:: https://readthedocs.org/projects/django-delayed-union/badge/?style=flat\n    :target: https://readthedocs.org/projects/django-delayed-union\n    :alt: Documentation Status\n\n.. |travis| image:: https://travis-ci.org/roverdotcom/django-delayed-union.svg?branch=master\n    :alt: Travis-CI Build Status\n    :target: https://travis-ci.org/roverdotcom/django-delayed-union\n\n.. |codecov| image:: https://codecov.io/github/roverdotcom/django-delayed-union/coverage.svg?branch=master\n    :alt: Coverage Status\n    :target: https://codecov.io/github/roverdotcom/django-delayed-union\n\n.. |version| image:: https://img.shields.io/pypi/v/django-delayed-union.svg\n    :alt: PyPI Package latest release\n    :target: https://pypi.python.org/pypi/django-delayed-union\n\n.. |commits-since| image:: https://img.shields.io/github/commits-since/roverdotcom/django-delayed-union/v0.1.7.svg\n    :alt: Commits since latest release\n    :target: https://github.com/roverdotcom/django-delayed-union/compare/v0.1.7...master\n\n.. |wheel| image:: https://img.shields.io/pypi/wheel/django-delayed-union.svg\n    :alt: PyPI Wheel\n    :target: https://pypi.python.org/pypi/django-delayed-union\n\n.. |supported-versions| image:: https://img.shields.io/pypi/pyversions/django-delayed-union.svg\n    :alt: Supported versions\n    :target: https://pypi.python.org/pypi/django-delayed-union\n\n.. |django-versions| image:: https://img.shields.io/pypi/djversions/django-delayed-union.svg\n   :alt: Django versions\n   :target: https://pypi.python.org/pypi/django-delayed-union\n\n\n.. end-badges\n\n``django-delayed-union`` is library designed to workaround some\ndrawbacks with Django's union, intersection, and difference\noperations.  In particular, once one of these operations is performed,\ncertain methods on the queryset will silently not work::\n\n  \u003e\u003e\u003e qs = User.objects.filter(id=1)\n  \u003e\u003e\u003e unioned_qs = qs.union(qs)\n  \u003e\u003e\u003e should_be_empty_qs = unioned_qs.exclude(id=1)\n  \u003e\u003e\u003e user, = list(should_be_empty_qs); user.id\n  1\n\nIn order to work around this, ``django-delayed-union`` provides\nwrappers around a collection of querysets.  These wrappers implement a\nsimilar interface to ``QuerySet``, and delay performing the union,\nintersection, or difference operations until they are needed::\n\n  \u003e\u003e\u003e from django_delayed_union import DelayedUnionQuerySet\n  \u003e\u003e\u003e qs = User.objects.filter(id=1)\n  \u003e\u003e\u003e unioned_qs = DelayedUnionQuerySet(qs, qs)\n  \u003e\u003e\u003e empty_qs = unioned_qs.exclude(id=1)\n  \u003e\u003e\u003e list(empty_qs)\n  []\n\nOperations which would typically return a new ``QuerySet`` instead\nreturn a new ``DelayedQuerySet`` with the operation applied to its\ncollection of querysets.\n\nOne example of where this code has been useful with is when the the\nMySQL query planner has chosen an inefficient query plan for the\nqueryset of a `Django REST Framework \u003chttps://github.com/foo/\u003e`_ view\nwhich used an ``OR`` condition.  By using ``DelayedUnionQuerySet``,\nsubclasses could perform additional filters on the queryset while\nstill maintaining the efficient query plan.\n\n* Free software: BSD 3-Clause License\n\nInstallation\n============\n\n::\n\n    pip install django-delayed-union\n\nDocumentation\n=============\n\nhttps://django-delayed-union.readthedocs.io/\n\nDevelopment\n===========\n\nTo run the all tests run::\n\n    tox\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froverdotcom%2Fdjango-delayed-union","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froverdotcom%2Fdjango-delayed-union","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froverdotcom%2Fdjango-delayed-union/lists"}