{ "info": { "author": "Brijesh Bittu", "author_email": "brijeshb42@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "Querybuilder\n============\n\nFor the following Table example:\n\n.. code:: sql\n\n CREATE TABLE article (\n id integer NOT NULL,\n created timestamp without time zone NOT NULL,\n title character varying(255) NOT NULL,\n type_id integer NOT NULL,\n topic_id integer NOT NULL,\n author_ids integer[] NOT NULL,\n category_ids integer[],\n tags character varying(255)[],\n keywords character varying(255)[],\n summary text,\n content text NOT NULL,\n cover jsonb NOT NULL,\n editors_pick boolean NOT NULL,\n pageviews bigint NOT NULL,\n updated timestamp without time zone NOT NULL,\n published timestamp without time zone,\n permalink character varying(255),\n cust_meta jsonb\n );\n\nSpecifications\n--------------\n\n- For all articles with ``type_id`` equal to ``1`` (``type_id = 1``):\n ``json { \"EQ\": { \"type_id\": 1 } }`` Same structure is\n for:\n\n+----------------------------+------------+----------+------------------------------+\n| Condition | JSON KEY | Symbol | JSON Query |\n+============================+============+==========+==============================+\n| Less than | LT | < | ``{\"LT\": {\"type_id\": 2}}`` |\n+----------------------------+------------+----------+------------------------------+\n| Less than or Equal to | LE | <= | ``{\"LE\": {\"type_id\": 2}}`` |\n+----------------------------+------------+----------+------------------------------+\n| Greater than | GT | > | ``{\"GT\": {\"type_id\": 2}}`` |\n+----------------------------+------------+----------+------------------------------+\n| Greater than or Equal to | GE | >= | ``{\"GE\": {\"type_id\": 2}}`` |\n+----------------------------+------------+----------+------------------------------+\n| Not equal | NE | != | ``{\"NE\": {\"type_id\": 2}}`` |\n+----------------------------+------------+----------+------------------------------+\n\nIN\n''\n\nFor all articles where ``type_id`` is in ``[1, 2, 3]``, the JSON query\nwill be:\n\n.. code:: json\n\n {\n \"IN\": {\n \"pageviews\": [1, 2, 3]\n }\n }\n\nBETWEEN\n'''''''\n\nFor all articles with ``pageviews`` between 10000 and 15000, the JSON\nquery will be:\n\n.. code:: json\n\n {\n \"BETWEEN\": {\n \"pageviews\": [10000, 15000]\n }\n }\n\nCONTAINS\\_ANY\n'''''''''''''\n\nFor all articles where ``author_ids`` contains any of ``8, 9, 10``, the\nJSON query will be:\n\n.. code:: json\n\n {\n \"CONTAINS_ANY\": {\n \"author_ids\": [8, 9, 10]\n }\n }\n\nCONTAINS\\_ALL\n'''''''''''''\n\nFor all articles where ``author_ids`` contains all of ``8, 9``, the JSON\nquery will be:\n\n.. code:: json\n\n {\n \"CONTAINS_ALL\": {\n \"author_ids\": [8, 9]\n }\n }\n\nSTARTSWITH\n''''''''''\n\n- For all articles where ``title`` starts with ``Film Review``, the\n JSON query will be:\n\n .. code:: json\n\n {\n \"STARTSWITH\": {\n \"title\": \"Film Review\"\n }\n }\n\nComplex Queries\n^^^^^^^^^^^^^^^\n\n- Complex queryies can contain nested structures of ``OR`` or ``AND``\n or both.\n\nFor all articles with ``pageviews`` between 10000 and 15000 and whose\n``author_ids`` contains ``8``\\ (the author\u2019s ID) (in above schema,\n``author_ids`` is an ArrayField in Postgres), the JSON query will be:\n\n.. code:: json\n\n {\n \"AND\": [\n {\n \"BETWEEN\": {\n \"pageviews\": [10000, 15000]\n }\n },\n {\n \"CONTAINS\": {\n \"author_ids\": [8]\n }\n }\n ]\n }\n\nRequirements\n^^^^^^^^^^^^\n\n- If there is only one condition, like ``pageviews`` > 100, the query\n can directly contain outermost key as one of\n ``EQ, NE, GT, GE, LT, LE, STARTSWITH, CONTAINS, CONTAINS_ALL, CONTAINS_ANY, BETWEEN``.\n\nexample:\n\n.. code:: json\n\n {\n \"STARTSWITH\": {\n \"title\": \"Film Review\"\n }\n }\n\n- But if there are more conditions involved, the outermost key must be\n one of \\`OR", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/brijeshb42/querybuilder/tarball/0.1.3", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/brijeshb42/querybuilder", "keywords": "SQL,peewee,querybuilder", "license": "http://www.opensource.org/licenses/mit-license.php", "maintainer": null, "maintainer_email": null, "name": "querybuilder", "package_url": "https://pypi.org/project/querybuilder/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/querybuilder/", "project_urls": { "Download": "https://github.com/brijeshb42/querybuilder/tarball/0.1.3", "Homepage": "https://github.com/brijeshb42/querybuilder" }, "release_url": "https://pypi.org/project/querybuilder/0.1.3/", "requires_dist": null, "requires_python": null, "summary": "An SQL query building specification to be used in conjunction with REST APIs and its implementation for peewee.", "version": "0.1.3" }, "last_serial": 2007692, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "5865426f58d7b222c147ed26d66bf89e", "sha256": "301f4ba50fbe0f7e3e12f248669bfb8d6e9347b078ce577b73c909938daedcd3" }, "downloads": -1, "filename": "querybuilder-0.1.1.zip", "has_sig": false, "md5_digest": "5865426f58d7b222c147ed26d66bf89e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9358, "upload_time": "2016-03-15T12:00:54", "url": "https://files.pythonhosted.org/packages/b5/5f/96830b2f51cece804a820af6c86bf462609c6c443fc6eee21bd7590f5845/querybuilder-0.1.1.zip" } ], "0.1.2": [], "0.1.3": [] }, "urls": [] }