{"id":13415527,"url":"https://github.com/paul-wolf/djaq","last_synced_at":"2025-10-26T20:32:01.098Z","repository":{"id":37405570,"uuid":"157835716","full_name":"paul-wolf/djaq","owner":"paul-wolf","description":"Django queries","archived":false,"fork":false,"pushed_at":"2023-05-03T10:40:41.000Z","size":1020,"stargazers_count":75,"open_issues_count":0,"forks_count":19,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-09-28T16:23:43.490Z","etag":null,"topics":["django-application","django-models","django-orm","djaq-query","query-language"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paul-wolf.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-11-16T08:22:42.000Z","updated_at":"2024-09-26T01:56:45.000Z","dependencies_parsed_at":"2024-01-06T09:54:56.850Z","dependency_job_id":"bd169bda-77f8-4545-852e-0354052da006","html_url":"https://github.com/paul-wolf/djaq","commit_stats":{"total_commits":236,"total_committers":2,"mean_commits":118.0,"dds":"0.36016949152542377","last_synced_commit":"edb17bd4b1db35f691756025599a009bf7ac7e54"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paul-wolf%2Fdjaq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paul-wolf%2Fdjaq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paul-wolf%2Fdjaq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paul-wolf%2Fdjaq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paul-wolf","download_url":"https://codeload.github.com/paul-wolf/djaq/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219862132,"owners_count":16555959,"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":["django-application","django-models","django-orm","djaq-query","query-language"],"created_at":"2024-07-30T21:00:50.038Z","updated_at":"2025-10-26T20:31:55.613Z","avatar_url":"https://github.com/paul-wolf.png","language":"Python","readme":"Djaq\n====\n\n|Python tests| |RTD build| |Python versions| |PyPi version| \n\n\n.. |Python tests| image:: https://github.com/paul-wolf/djaq/actions/workflows/run_unit_tests.yml/badge.svg\n   :target: https://github.com/paul-wolf/djaq/actions/workflows/run_unit_tests.yml\n   :alt: Unit test status\n   \n.. |RTD build| image:: https://readthedocs.org/projects/djaq/badge/?version=latest\n   :target: https://djaq.readthedocs.io/en/latest/?badge=latest\n   :alt: Documentation Status\n\n.. |Python versions| image:: https://img.shields.io/pypi/pyversions/djaq?color=brightgreen\n   :alt: PyPI - Python Version\n\n.. |PyPi version| image:: https://badge.fury.io/py/Djaq.svg\n   :target: https://badge.fury.io/py/Djaq\n   :alt: PyPi Version\n\nDjaq - pronounced “Jack” - is an alternative to the Django QuerySet API. \n\nWhat sets it apart: \n\n* No need to import models \n* Clearer, more natural query syntax\n* More powerful expressions \n* More consistent query syntax without resorting to idiosyncratic methods like \n  ``F()`` expressions, ``annotate()``, ``aggregate()`` \n* Column expressions are entirely evaluated in the database\n* Extensible: you can write your own functions\n* Pandas: Easily turn a query into Pandas Dataframe\n\nThere is also a JSON representation of queries, so you can send queries from a\nclient. It's an instant API to your data. No need to write backend classes and\nserializers.\n\nDjaq queries are strings. A query string for our example dataset might\nlook like this:\n\n.. code:: shell\n\n   DQ(\"Book\", \"name as title, publisher.name as publisher\").go()\n\nThis retrieves a list of book titles with book publisher. But you can\nformulate far more sophisticated queries; see below. You can send Djaq\nqueries from any language, Java, Javascript, golang, etc. to a Django\napplication and get results as JSON. In contrast to REST frameworks,\nlike TastyPie or Django Rest Framework (DRF), you have natural access to\nthe Django ORM from the client.\n\nDjaq sits on top of the Django ORM. It can happily be used alongside\nQuerySets.\n\n-  `Documentation \u003chttps://djaq.readthedocs.io\u003e`__\n-  `Installation \u003chttps://djaq.readthedocs.io/en/latest/installation.html\u003e`__\n-  `Settings \u003chttps://djaq.readthedocs.io/en/latest/settings.html\u003e`__\n-  `Query\n   Usage \u003chttps://djaq.readthedocs.io/en/latest/query_usage.html\u003e`__\n-  `Sample\n   Project \u003chttps://djaq.readthedocs.io/en/latest/sample_project.html\u003e`__\n\nHere's an example comparison between Djaq and Django QuerySets that gets every\npublisher and counts the books for each that are above and below a rating\nthreshold.\n\n.. code:: python\n\n   DQ(\"Book\", \"\"\"publisher.name,\n       sumif(rating \u003c 3, 1, 0) as below_3,\n       sumif(rating \u003e= 3, 1, 0) as above_3\n       \"\"\")\n\ncompared to QuerySet:\n\n.. code:: python\n   \n   from django.db.models import Count, Q\n   above_3 = Count('book', filter=Q(book__rating__gt=3))\n   below_3 = Count('book', filter=Q(book__rating__lte=3))\n   Publisher.objects.annotate(below_3=below_3).annotate(above_3=above_3)\n\nGet average, maximum, minimum price of books:\n\n.. code:: python\n\n   DQ(\"Book\", \"avg(price), max(price), min(price)\")\n\ncompared to QuerySet:\n\n.. code:: python\n\n   Book.objects.aggregate(Avg('price'), Max('price'), Min('price'))\n\nGet the difference from the average off the maximum price for each publisher:\n\n.. code:: python\n\n   DQ(\"Book\", \"publisher.name, max(price) - avg(price) as price_diff\")\n\ncompared to QuerySet:\n\n.. code:: python\n\n   from django.db.models import Avg, Max\n   Book.objects.values(\"publisher__name\") \\\n      .annotate(price_diff=Max('price') - Avg('price'))\n","funding_links":[],"categories":["Third-Party Packages","Best Django Admin Interface Resources"],"sub_categories":["APIs","**🖥️ Django REST Framework \u0026 API-Related Packages**"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaul-wolf%2Fdjaq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaul-wolf%2Fdjaq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaul-wolf%2Fdjaq/lists"}