cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Unable to update a Relationship

Hi good morning,

I am developing an application that updates my graph in real-time. I receive an invoice id that I have to update.
In my case, the invoice is a Relationship between two subjects.

I'm working Python development environment.
I can read the Report, but I cannot update it.

the Cypher query working perfectly

MATCH ()-[r:HAS_INVOICE {invoiceId: 40624}]->() 
set r.updateField=True;

 

This is the python code

    # tag::updateRelationship[]
    def update_relationship(self, memento_invoice):
        def upd_relationship(tx, id):
            return tx.run(
                        "MATCH ()-[r:HAS_INVOICE {invoiceId: toInteger($invoice_id)}]->()" 
                        "SET r.alreadyExisted=true;",{"invloice_id": id}
                        ).consume
        with self.driver.session() as session:
            result = session.write_transaction(upd_relationship, id)
            return result
    # end::updateRelationship[]

 

Still receive the following error

data.py", line 340, in fix_parameters
    raise TypeError("Parameters of type {} are not supported".format(type(value).__name__))
TypeError: Parameters of type builtin_function_or_method are not supported

Any suggestion or help please

 

Rinaldo 

1 ACCEPTED SOLUTION

glilienfield
Ninja
Ninja

@ameyasoft is correct.  Don't use quotes around the key in the map.  Use this instead, and it was not spelled correctly as well. You don't need to use 'toInteger' if you pass the value in as an integer. 

 

 

 

{invoice_id: id}

 

 

 

View solution in original post

3 REPLIES 3

ameyasoft
Graph Maven

Check this: 

{"invloice_id": id}

 This must be raising that error.

glilienfield
Ninja
Ninja

@ameyasoft is correct.  Don't use quotes around the key in the map.  Use this instead, and it was not spelled correctly as well. You don't need to use 'toInteger' if you pass the value in as an integer. 

 

 

 

{invoice_id: id}

 

 

 

Thank you @ameyasoft and @glilienfield  for your reply 

your solution it's work fine, another error on my side miss speling 

invloice_id

in place of invoice_id

 

Thank you guys for your help.

Rinaldo