Given a string containing a Neo4j cypher query, how to determine quickly in python it is db read or db write.
Currently I have thought of two ways of seeing this -
- Check for keywords like CREATE, DELETE etc to tag write queries
and
MATCH, START etc to tag read queries. - Otherwise we can check for patterns according to this link here- Neo4j refcard and write a parser for it accordingly.
Method 1 fails here -
MATCH (n:Person {id:1, create:3}) return n
And method 2 looks too deep for seemingly small task.
Any other/better ideas to do the same?