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.

Combining Cypher and APOC queries

I am trying to update node properties of a PostgreSQL database that I have running in a virtual environment. I am building a Jazz knowledge base and would like to use the node ids to query additional properties from the PSQL database using APOC.

I have tried unwinding the ids and using them to run the SQL statements with APOC.

This is the code I have tried thus far:

MATCH (a:Artist)
WHERE a.genre = 'jazz'
WITH COLLECT(a.mbid) AS ids
UNWIND ids AS id
CALL apoc.load.jdbc('myDB',
"select DISTINCT a.gid, ar.name as country FROM artist a INNER JOIN area ar on a.area = ar.id WHERE a.gid = ?", [id]) YIELD row
MATCH (a:Artist) WHERE a.mbid = row.gid SET a.country = row.country
RETURN COUNT(a.country)

I am running into an error saying "ERROR: operator does not exist: uuid = character varying". Is there anyway to use the ids from the Cypher query to update each node individually through individual SQL statements with APOC?

1 REPLY 1

Without kowing a thing about your data and how they are data typed on both sides, at first glance, the error: "ERROR: operator does not exist: uuid = character varying" seems to indicate a collation issue (i.e. a common ETL concern when dealing with disparate database systems) when it expects an operator to perform some sort of data type conversion for the VARCHAR data type. Cannot tell if it is from PostgreSQL or Neo4j . Make sure that data types coming and going are fully matched to their respective systems. I would start there first....just a suggestion.