neo4j-streams icon indicating copy to clipboard operation
neo4j-streams copied to clipboard

Add option to create non-existent nodes at relationship creation

Open marek-babic opened this issue 4 years ago • 3 comments

Feature description

Working with the Kafka Connect sink connector in the CUD mode, when creating a relationship between nodes that don't exist (one or both of them) the relationship is not created. It would be good if there was an option that would instruct the connector to create the missing node(s) with the information provided in the message ie. data in the from and to fields where ids and labels are specified.

Currently we have:

{
	"op":"merge",
	"properties":{"propkey":"propval"},
	"rel_type":"a-likes-target-node",
	"labels":["a-likes-target-node"],
	"from":{"ids":{"node-a":"node-a-id"},"labels":["geo"]},
	"to":{"ids":{"classicifation":"classicifation-1"},"labels":["soil"]},
	"type":"relationship"
}

From a slack conversation with one of the guys working on the connector we could have:

{
	"op":"merge",
	"properties":{"propkey":"propval"},
	"rel_type":"a-likes-target-node",
	"labels":["a-likes-target-node"],
	"from":{"ids":{"node-a":"node-a-id"},"labels":["geo"], "op": "merge"},
	"to":{"ids":{"classicifation":"classicifation-1"},"labels":["soil"], "op": "merge"},
	"type":"relationship"
}

marek-babic avatar Feb 18 '21 11:02 marek-babic

@marek-babic I'm the guy who you chatted with, thanks for opening this we'll keep you posted

conker84 avatar Feb 18 '21 11:02 conker84

Hey @conker84, brilliant, thanks.

marek-babic avatar Feb 18 '21 11:02 marek-babic

Hi, Missing

override val properties: Map<String, Any?> = emptyMap(),

For CUDNodeRel. So, properties are just avoid at node merge if using it with relationship.

Gwojda avatar Nov 09 '22 10:11 Gwojda