Cypher query parameter problem

I am trying to pass on the parameter to the cypher query in a function but it is not returning the results as expected. First error was ClientError: {code: Neo.ClientError.Statement.ParameterMissing} {message: Expected parameter(s): x} I checked it on another forum where I also had to pass the parameter along with query run session I did so and error disappeared but still it didn't get the results as expected and returned the empty nodes.

In the graph db the nodes are connected with 4 types of relationships with an ids.

This is what I have tried so far:

def get_objects(x):
    query = ''' MATCH (p)-[r]->(a) where = $x RETURN; ''' 
    resultNodes =, x = x)
    df = DataFrame(resultNodes)
    return df

def find_max_1():
    return authors,terms,venues,papers

def main():
    m = m=find_max_1()

if __name__ == "__main__":

and the output is:

Empty DataFrame
Columns: []
Index: []
Empty DataFrame
Columns: []
Index: []
Empty DataFrame
Columns: []
Index: []
Empty DataFrame
Columns: []
Index: []

I also checked giving the absolute value as ''' MATCH (p)-[r]->(a) where = '1' RETURN ''' into the function, it worked fine but there is a problem when i pass it through the function?

Any kind of help in right direction would be appreciated.

Thanks in advance.

Hello @mumarhafiz and welcome to the Neo4j community :slight_smile:

In your example, you passed a String:

MATCH (p)-[r]->(a) where = '1' RETURN

So you should write:

query = "MATCH (p)-[r]->(a) where = toString($x) RETURN;"


query = "MATCH (p)-[r]->(a) where = $x RETURN;" 
resultNodes =, x=str(x))

Moreover, do you have an id parameter on your nodes and relations or do you want to use the Neo4j internal ID? If it's the Neo4j internal ID, you should have a look at id().


Thanks for your response. Meanwhile I tried the other way and convert the parameter to string separately and then passed to cypher statement. It worked in my scenario, but this is clean and efficient.

And yes, I have the id parameter on each of the nodes and also for the relations.

Thanks for your help.