{"id":18257900,"url":"https://github.com/linkdd/link.dbrequest","last_synced_at":"2025-04-08T22:46:45.293Z","repository":{"id":62576260,"uuid":"60353062","full_name":"linkdd/link.dbrequest","owner":"linkdd","description":"Database agnostic query system","archived":false,"fork":false,"pushed_at":"2016-09-02T21:34:58.000Z","size":78,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-16T02:42:33.927Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/linkdd.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-03T14:17:04.000Z","updated_at":"2016-06-06T15:19:49.000Z","dependencies_parsed_at":"2022-11-03T19:05:35.812Z","dependency_job_id":null,"html_url":"https://github.com/linkdd/link.dbrequest","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkdd%2Flink.dbrequest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkdd%2Flink.dbrequest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkdd%2Flink.dbrequest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkdd%2Flink.dbrequest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linkdd","download_url":"https://codeload.github.com/linkdd/link.dbrequest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247941719,"owners_count":21022037,"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-05T10:28:06.547Z","updated_at":"2025-04-08T22:46:45.275Z","avatar_url":"https://github.com/linkdd.png","language":"Python","funding_links":["https://liberapay.com/linkdd/donate"],"categories":[],"sub_categories":[],"readme":"link.dbrequest\n==============\n\n**link.dbrequest** is a database agnostic query system.\n\nSee documentation_ for more informations.\n\n.. _documentation: https://linkdbrequest.readthedocs.io\n\n.. image:: https://img.shields.io/pypi/l/link.dbrequest.svg?style=flat-square\n   :target: https://pypi.python.org/pypi/link.dbrequest/\n   :alt: License\n\n.. image:: https://img.shields.io/pypi/status/link.dbrequest.svg?style=flat-square\n   :target: https://pypi.python.org/pypi/link.dbrequest/\n   :alt: Development Status\n\n.. image:: https://img.shields.io/pypi/v/link.dbrequest.svg?style=flat-square\n   :target: https://pypi.python.org/pypi/link.dbrequest/\n   :alt: Latest release\n\n.. image:: https://img.shields.io/pypi/pyversions/link.dbrequest.svg?style=flat-square\n   :target: https://pypi.python.org/pypi/link.dbrequest/\n   :alt: Supported Python versions\n\n.. image:: https://img.shields.io/pypi/implementation/link.dbrequest.svg?style=flat-square\n   :target: https://pypi.python.org/pypi/link.dbrequest/\n   :alt: Supported Python implementations\n\n.. image:: https://img.shields.io/pypi/wheel/link.dbrequest.svg?style=flat-square\n   :target: https://pypi.python.org/pypi/link.dbrequest\n   :alt: Download format\n\n.. image:: https://travis-ci.org/linkdd/link.dbrequest.svg?branch=master\u0026style=flat-square\n   :target: https://travis-ci.org/linkdd/link.dbrequest\n   :alt: Build status\n\n.. image:: https://coveralls.io/repos/github/linkdd/link.dbrequest/badge.svg?style=flat-square\n   :target: https://coveralls.io/r/linkdd/link.dbrequest\n   :alt: Code test coverage\n\n.. image:: https://img.shields.io/pypi/dm/link.dbrequest.svg?style=flat-square\n   :target: https://pypi.python.org/pypi/link.dbrequest/\n   :alt: Downloads\n\n.. image:: https://landscape.io/github/linkdd/link.dbrequest/master/landscape.svg?style=flat-square\n   :target: https://landscape.io/github/linkdd/link.dbrequest/master\n   :alt: Code Health\n\nInstallation\n------------\n\n.. code-block:: text\n\n   pip install link.dbrequest\n\nFeatures\n--------\n\n * database agnostic\n * lazy query resolving\n * cached queries\n * queries are unique\n\nExamples\n--------\n\nGetting a backend:\n\n.. code-block:: python\n\n   from link.middleware.core import Middleware\n\n   # Will open a QueryManager using a MongoDB backend\n   manager = Middleware.get_middleware_by_uri('query+mongo://localhost:27107/mydatabase/mycollection')\n   # Will open a QueryManager using a SQL backend\n   manager = Middleware.get_middleware_by_uri('query+sql://localhost:5432/mydatabase/mytable')\n\n\nOperations on the backend:\n\n.. code-block:: python\n\n   from link.dbrequest.expression import E, F\n   from link.dbrequest.assignment import A\n   from link.dbrequest.comparison import C\n\n\n   query = manager.all()  # get an iterable over all elements\n\n   manager.create(A('foo', 'bar'))  # put document {'foo': 'bar'} into database\n\n   doc = manager.get(C('foo') != 'bar')  # get single element, or None\n\nOperations on queries:\n\n.. code-block:: python\n\n   docs = list(query)  # iterate over query to execute the request\n   docs = list(query)  # use cache when iterating again\n\n   # create a new query from the first one\n   q2 = query.filter(C('foo') == 'bar')\n   assert query is not q2\n\n   # exclude documents without a field named \"bar\"\n   q3 = q2.exclude(~C('bar'))\n\n   # filter documents \"weight \u003e 5\" and \"prop1 \u003c prop2 * 5\"\n   q4 = q3.filter((C('weight') \u003e 5) \u0026 (C('prop1') \u003c (E('prop2') * 5)))\n\n   # set \"prop3 = prop1 + prop2\" on q2 result\n   docs = q2.update(A('prop3', E('prop1') + E('prop2')))\n\n   # delete documents\n   q3.delete()\n\nOperations on documents:\n\n.. code-block:: python\n\n   # save/delete a single document\n   doc.save()\n   doc.delete()\n\nDonating\n--------\n\n.. image:: https://liberapay.com/assets/widgets/donate.svg\n   :target: https://liberapay.com/linkdd/donate\n   :alt: Support via Liberapay\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinkdd%2Flink.dbrequest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinkdd%2Flink.dbrequest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinkdd%2Flink.dbrequest/lists"}