ageqrp


Nameageqrp JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryQuery Results Parser (QRP) for Apache AGE database queries using psycopg
upload_time2024-12-12 12:32:53
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseMIT License Copyright (c) 2024 Chris Joakim Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords apache age parser psycopg query results
VCS
bugtrack_url
requirements black certifi charset-normalizer click coverage docutils idna importlib-metadata iniconfig jaraco-classes jaraco-context jaraco-functools keyring markdown-it-py mdurl more-itertools mypy-extensions nh3 packaging pathspec pkginfo platformdirs pluggy pygments pytest pytest-cov readme-renderer requests requests-toolbelt rfc3986 rich twine urllib3 zipp
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ageqrp

Query Results Parser (QRP) for Apache AGE database queries using psycopg

## Urls

- PyPi: https://pypi.org/project/ageqrp/
- GitHub: https://github.com/cjoakim/ageqrp

## Features

- Easy to use
- Transforms the augmented AGE JSON into regular JSON


## Quick start


### Installation

```
$ pip install ageqrp
```

### Use

```
import json

from ageqrp import QueryResultParser

import psycopg_pool

...

# This example is from a FastAPI web application

async def post_query(req: Request, query_type):
    form_data = await req.form()
    cypher_query = form_data.get("cypher_query").replace("\r\n", "").strip()
    result_objects = list()
    qrp = QueryResultParser()
        
    try:
        async with req.app.async_pool.connection() as conn:
            async with conn.cursor() as cursor:
                try:
                    await asyncio.wait_for(cursor.execute(cypher_query), timeout=10.0)
                    results = await cursor.fetchall()
                    for row in results:
                        # psycopg results parsed into regular JSON objects here
                        result_objects.append(qrp.parse(row))
```

The above cypher_query may look something like this:

```
select * from ag_catalog.cypher('legal_cases',
  $$ MATCH (c:Case {id: 999494})-[r:cites*1..2]->(c2:Case) RETURN c,r limit 100 $$)
  as (c agtype, r agtype);
```

Also see file **sample-program.py** in the GitHub repo as well as the unit tests
in the tests/ directory.

---

## Changelog

Current version: 0.2.0

-  2024/12/12, version 0.2.0, Docs and tests enhanced
-  2024/12/01, version 0.1.0, Initial Production release

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ageqrp",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": "Chris Joakim <christopher.joakim@gmail.com>",
    "keywords": "Apache AGE, parser, psycopg, query, results",
    "author": null,
    "author_email": "Chris Joakim <christopher.joakim@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/66/de/4f37d35d70cd1e22839b2c881e1d83ef28dc1daeb45e94564b090a795ecd/ageqrp-0.2.0.tar.gz",
    "platform": null,
    "description": "# ageqrp\n\nQuery Results Parser (QRP) for Apache AGE database queries using psycopg\n\n## Urls\n\n- PyPi: https://pypi.org/project/ageqrp/\n- GitHub: https://github.com/cjoakim/ageqrp\n\n## Features\n\n- Easy to use\n- Transforms the augmented AGE JSON into regular JSON\n\n\n## Quick start\n\n\n### Installation\n\n```\n$ pip install ageqrp\n```\n\n### Use\n\n```\nimport json\n\nfrom ageqrp import QueryResultParser\n\nimport psycopg_pool\n\n...\n\n# This example is from a FastAPI web application\n\nasync def post_query(req: Request, query_type):\n    form_data = await req.form()\n    cypher_query = form_data.get(\"cypher_query\").replace(\"\\r\\n\", \"\").strip()\n    result_objects = list()\n    qrp = QueryResultParser()\n        \n    try:\n        async with req.app.async_pool.connection() as conn:\n            async with conn.cursor() as cursor:\n                try:\n                    await asyncio.wait_for(cursor.execute(cypher_query), timeout=10.0)\n                    results = await cursor.fetchall()\n                    for row in results:\n                        # psycopg results parsed into regular JSON objects here\n                        result_objects.append(qrp.parse(row))\n```\n\nThe above cypher_query may look something like this:\n\n```\nselect * from ag_catalog.cypher('legal_cases',\n  $$ MATCH (c:Case {id: 999494})-[r:cites*1..2]->(c2:Case) RETURN c,r limit 100 $$)\n  as (c agtype, r agtype);\n```\n\nAlso see file **sample-program.py** in the GitHub repo as well as the unit tests\nin the tests/ directory.\n\n---\n\n## Changelog\n\nCurrent version: 0.2.0\n\n-  2024/12/12, version 0.2.0, Docs and tests enhanced\n-  2024/12/01, version 0.1.0, Initial Production release\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Chris Joakim  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Query Results Parser (QRP) for Apache AGE database queries using psycopg",
    "version": "0.2.0",
    "project_urls": {
        "Homepage": "https://github.com/cjoakim/ageqrp",
        "Issues": "https://github.com/cjoakim/ageqrp/issues",
        "Repository": "https://github.com/cjoakim/ageqrp"
    },
    "split_keywords": [
        "apache age",
        " parser",
        " psycopg",
        " query",
        " results"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9e8c180ccf6d074379e4c1750f5bd6c9fdc8b220f075bdda3a9c238813cdb793",
                "md5": "b9091b396d0d7b71e42327950e000467",
                "sha256": "781379afdab125fd00f9da79279c67aca9533ff6b73fa90000aee415b696e143"
            },
            "downloads": -1,
            "filename": "ageqrp-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b9091b396d0d7b71e42327950e000467",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 4645,
            "upload_time": "2024-12-12T12:32:50",
            "upload_time_iso_8601": "2024-12-12T12:32:50.093218Z",
            "url": "https://files.pythonhosted.org/packages/9e/8c/180ccf6d074379e4c1750f5bd6c9fdc8b220f075bdda3a9c238813cdb793/ageqrp-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "66de4f37d35d70cd1e22839b2c881e1d83ef28dc1daeb45e94564b090a795ecd",
                "md5": "a085dfcfc6673cd19fa3de7ddc1a6560",
                "sha256": "d37632f31d17cda76d68b9ccd55d30e02e66203097f09b6bd05e144427d9feeb"
            },
            "downloads": -1,
            "filename": "ageqrp-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a085dfcfc6673cd19fa3de7ddc1a6560",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 6095,
            "upload_time": "2024-12-12T12:32:53",
            "upload_time_iso_8601": "2024-12-12T12:32:53.795546Z",
            "url": "https://files.pythonhosted.org/packages/66/de/4f37d35d70cd1e22839b2c881e1d83ef28dc1daeb45e94564b090a795ecd/ageqrp-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-12 12:32:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cjoakim",
    "github_project": "ageqrp",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "black",
            "specs": [
                [
                    "==",
                    "24.10.0"
                ]
            ]
        },
        {
            "name": "certifi",
            "specs": [
                [
                    "==",
                    "2024.8.30"
                ]
            ]
        },
        {
            "name": "charset-normalizer",
            "specs": [
                [
                    "==",
                    "3.4.0"
                ]
            ]
        },
        {
            "name": "click",
            "specs": [
                [
                    "==",
                    "8.1.7"
                ]
            ]
        },
        {
            "name": "coverage",
            "specs": [
                [
                    "==",
                    "7.6.8"
                ]
            ]
        },
        {
            "name": "docutils",
            "specs": [
                [
                    "==",
                    "0.21.2"
                ]
            ]
        },
        {
            "name": "idna",
            "specs": [
                [
                    "==",
                    "3.10"
                ]
            ]
        },
        {
            "name": "importlib-metadata",
            "specs": [
                [
                    "==",
                    "8.5.0"
                ]
            ]
        },
        {
            "name": "iniconfig",
            "specs": [
                [
                    "==",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "jaraco-classes",
            "specs": [
                [
                    "==",
                    "3.4.0"
                ]
            ]
        },
        {
            "name": "jaraco-context",
            "specs": [
                [
                    "==",
                    "6.0.1"
                ]
            ]
        },
        {
            "name": "jaraco-functools",
            "specs": [
                [
                    "==",
                    "4.1.0"
                ]
            ]
        },
        {
            "name": "keyring",
            "specs": [
                [
                    "==",
                    "25.5.0"
                ]
            ]
        },
        {
            "name": "markdown-it-py",
            "specs": [
                [
                    "==",
                    "3.0.0"
                ]
            ]
        },
        {
            "name": "mdurl",
            "specs": [
                [
                    "==",
                    "0.1.2"
                ]
            ]
        },
        {
            "name": "more-itertools",
            "specs": [
                [
                    "==",
                    "10.5.0"
                ]
            ]
        },
        {
            "name": "mypy-extensions",
            "specs": [
                [
                    "==",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "nh3",
            "specs": [
                [
                    "==",
                    "0.2.19"
                ]
            ]
        },
        {
            "name": "packaging",
            "specs": [
                [
                    "==",
                    "24.2"
                ]
            ]
        },
        {
            "name": "pathspec",
            "specs": [
                [
                    "==",
                    "0.12.1"
                ]
            ]
        },
        {
            "name": "pkginfo",
            "specs": [
                [
                    "==",
                    "1.10.0"
                ]
            ]
        },
        {
            "name": "platformdirs",
            "specs": [
                [
                    "==",
                    "4.3.6"
                ]
            ]
        },
        {
            "name": "pluggy",
            "specs": [
                [
                    "==",
                    "1.5.0"
                ]
            ]
        },
        {
            "name": "pygments",
            "specs": [
                [
                    "==",
                    "2.18.0"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": [
                [
                    "==",
                    "8.3.3"
                ]
            ]
        },
        {
            "name": "pytest-cov",
            "specs": [
                [
                    "==",
                    "5.0.0"
                ]
            ]
        },
        {
            "name": "readme-renderer",
            "specs": [
                [
                    "==",
                    "44.0"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    "==",
                    "2.32.3"
                ]
            ]
        },
        {
            "name": "requests-toolbelt",
            "specs": [
                [
                    "==",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "rfc3986",
            "specs": [
                [
                    "==",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "rich",
            "specs": [
                [
                    "==",
                    "13.9.4"
                ]
            ]
        },
        {
            "name": "twine",
            "specs": [
                [
                    "==",
                    "5.1.1"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    "==",
                    "2.2.3"
                ]
            ]
        },
        {
            "name": "zipp",
            "specs": [
                [
                    "==",
                    "3.21.0"
                ]
            ]
        }
    ],
    "lcname": "ageqrp"
}
        
Elapsed time: 0.40631s