Jwrede commented on issue #998:
URL: https://github.com/apache/age/issues/998#issuecomment-7092593483

   Until AGE is available on RDS, I wrote a workaround that keeps the 
`cypher()` SQL interface but needs no C extension: 
https://github.com/Jwrede/pgcypher
   
   It has three parts. `pgcypher install` creates an `ag_catalog` schema in 
plain SQL and PL/pgSQL (`create_graph`, `drop_graph`, an `agtype` domain, 
helper functions), so it installs with a role that has no superuser rights. A 
translator turns a Cypher query into one PostgreSQL statement (CTEs, recursive 
CTEs for variable-length paths, data-modifying CTEs for writes) and prints 
results in AGE's text format (`::vertex`, `::edge`, `::path`). A wire protocol 
proxy sits between the application and the database, rewrites `cypher('graph', 
$$ ... $$, $1) AS (...)` calls, turns `LOAD 'age'` and `CREATE EXTENSION age` 
into no-ops, and passes everything else through, so existing AGE SQL can stay 
as it is.
   
   How it is tested: the same graph and the same SQL run against Apache AGE 
1.8.0 (the `apache/age:release_PG18_1.8.0` image) and against pgcypher on plain 
PostgreSQL 14, 16 and 18 as a non-superuser role, and the rows are compared 
after mapping ids. That covers 42 read queries (MATCH, OPTIONAL MATCH, WITH, 
UNWIND, aggregation, variable-length paths, paths, functions, parameters), 9 
write sequences (CREATE, MERGE with ON CREATE/ON MATCH, SET, REMOVE, DELETE, 
DETACH DELETE) and AGE's error when deleting a vertex that still has edges.
   
   Limitations, so nobody is surprised:
   * I have not run it on RDS itself, only on plain PostgreSQL with a 
non-superuser role.
   * It is a subset of Cypher. Not supported: UNION, CALL, list comprehensions, 
pattern predicates, MERGE of longer patterns, AGE's agtype operators in 
surrounding SQL.
   * Storage is its own (one vertex and one edge table per graph, jsonb 
properties), so existing AGE data needs an export and reload, and SQL that 
reads AGE's label tables directly will not work.
   * `agtype` is a domain over text, so drivers that parse agtype by type OID 
get strings. The apache-age-python driver also needs `age_prepare_cypher()`, 
which it does not have.
   * No performance comparison with AGE yet.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to