Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-23-2022 12:25 PM
Hi
I just can't get the following. I'm using Google co-lab. The commented out line works as expected but after trying various options from threads I still can't get it. I'm just trying to pass the entity_type variable in after declaring it.
Also once this works I will then want to pass in the following so I assume it would be the same as the value passed to the get_slot method would also be a string entity_type = tracker.get_slot("entity_type")
Can anyone assist? Thanks.
Chris
10-23-2022 02:45 PM
I don't use the python driver, but from my reading of the documentation, it looks like if you do the following it should work:
result = session.run(query, entity_type = entity_type)
For production, you may want to look at the managed transactions instead of the auto-commit transactions you are using.
10-23-2022 02:59 PM
thanks it now gives me the following when i run that
<neo4j._sync.work.result.Result object at 0x7f056b850610>
10-23-2022 04:47 PM
In the above, I meant the string that represents the cypher query for the 'query' parameter.
The 'Result' returned is a list of "Records' You need extract the data from it.
https://neo4j.com/docs/api/python-driver/current/api.html#result
10-24-2022 09:22 AM
Thanks - I don't think I'm getting this. I don't use Python regularly. Can you possibly type out what the query should be? The first commented out line gives me what I want so I'm not clear on what I'm meant to type -
10-24-2022 06:40 PM
I'm a Java developer, but I tried to provide some guidance.
If you are expecting a single result, you can try this:
result.single()[0]
You will need to iterate through the records of a result, if the result has more than one record. Something like this.
definitions = []
result = session.run(queryString, entity_type = entity_type)
for record in result:
definitions.append(record["x"])
All the sessions of the conference are now available online