I'm trying to query my Employee model with .cypher
within my Django view. I've used this query elsewhere, so I know that part works.
query_string = "MATCH (n)-[r:REPORTS_TO|BRANCH_OF|OVERSEEN_BY]->() RETURN n, r"
query_results = Employee.cypher(
self = Employee,
query = query_string,
params = None)
*** ERROR _pre_action_check()
missing 1 required positional argument: 'action'
This error points to line 204 here:
https://github.com/neo4j-contrib/neomodel/blob/master/neomodel/core.py
I've tried:
Also, if I try to follow the documentation by defining the cypher call within the model and then calling it in the view... I still get the same error
UPDATE: full trace here https://i.sstatic.net/hPs3B.jpg
The fact that you're calling this method with three positional args seems wrong.
The method signature is:
def cypher(self, query, params=None):
-self
is already provided by your Employee.
prefix. (WRONG, see below)
-query
should just be passed in as positional query_string
argument
-params=None
is simply passing the default value, which is useless.
Have you tried Employee.cypher(query_string)
?
Based on what Tezra said, you need an instance of Employee:
employee = Employee()
Then call employee.cypher(query_string)