Current collected state Current
Observed since 21 Oct, 09:01 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Query Results Parser (QRP) for Apache AGE database queries using psycopg
Query Results Parser (QRP) for Apache AGE database queries using psycopg
$ pip install ageqrp
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.
Current version: 0.2.0
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.2.0 | 12 Dec 2024 | 0 |
This describes our collected data; it is not a security assessment.
Observed since 21 Oct, 09:01 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:0d090ffd2b1f825bf2cbc0e6b6d062c9b5c5f00c730770616a2dfb8b03423bcb