Transferring from MySQL Master Detail individual records to Neo4j nodes (denormalization)


(TahorSuiJuris) #1

Transferring from MySQL Master Detail individual records to Neo4j nodes (denormalization).

Would I still use a Master-Detail scenario?


(Andrew Bowman) #2

If this is always a 1-1 correspondence between these, with them both representing the same entity, then it would make more sense to keep all the properties on a single node, and just have the application logic select the appropriate fields from the node depending on the level of detail.

The tradeoff here of course is that you wouldn't be able to tell at a glance from the db itself which fields are at what level of view, that logic lives at the application layer itself. On the plus side, you only need a single node for an entity, and you have flexibility in the query itself to decide which fields to include at which level of detail without having to alter the db.


When creating Nodes, is it possible to also create a calculated node?
(TahorSuiJuris) #3

@andrew.bowman Thank you, the connections are one-to-many.

Single Purchase quantity is reduced by MANY Usage quantities, thus ONE Invoice to MANY Usages relationship.

One article I found but does not share enough to grasp Master-Detail in Neo4j.
Titled: When and How You Should Denormalize a Relational Database

Am in the process of exporting my data to CSV then importing into Neo4j node database.
Am going to go through the example with Northwind to get an idea prior to importing my data.

Are generated columns handled differently in Cypher?
Default Expression for purchasetotal:
FORMAT(SUM(purchasepoints * purchasecost),2) total

Any suggestions greatly appreciated.

Thank you.