When I try:
CALL apoc.load.jdbc('jdbc:mysql://localhost/mysql?user=root&password=root&useUnicode=true&characterEncoding=utf8','select * from db')YIELD row
WHERE row.label = 'dis' MERGE (n:dis {name: row.keyword})
WHERE row.label = 'part' MERGE (n:part {name: row.keyword})
and there is an error
Neo.ClientError.Statement.SyntaxError: Invalid input 'H': expected 'i/I'
you can use the apoc fucntions to do this
CALL apoc.merge.node(['Label'], identProps:{key:value, …}, onCreateProps:{key:value,…}, onMatchProps:{key:value,…}})
the following query will dynamically read label names and merge nodes with respective label
CALL apoc.load.jdbc('jdbc:mysql://localhost/mysql?user=root&password=root&useUnicode=true&characterEncoding=utf8','select * from db')YIELD row
CALL apoc.merge.node([row.label], identProps:{name:row.keyword}, onCreateProps:{}, onMatchProps:{}}) YIELD node
RETURN node
If you intend to match node with specific label, you should probably use the MATCH (:label)
clause instead of WHERE label = ...
CALL apoc.load.jdbc('jdbc:mysql://localhost/mysql?user=root&password=root&useUnicode=true&characterEncoding=utf8','select * from db')YIELD row
OPTIONAL MATCH (row:dis) MERGE (n:dis {name: row.keyword})
OPTIONAL MATCH (row:part) MERGE (n:part {name: row.keyword})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.