cancel
Showing results for 
Search instead for 
Did you mean: 

Auto identify relation based on field name in tables

MatFarma
Node

HiGuys!

This is my first question on here, so I hope I'm in the right place!

I have imported three different CSV files - tables - named Category, Product, Supplier from Northwind base. In those tables exist key ids name the same, e.g. in categories "categoryid" and in products also "categoryid" is there any possiblilty to create (auto detect) realations beetwen tables without queringi any Cypher code?

This idea will be helpfull in fast drawing db schem .
Thank you in advance !

3 REPLIES 3

steggy
Neo4j
Neo4j

@MatFarma if you're using the data importer, you can specifically tell it about the relationships when you do the import.

MatFarma
Node

Thank you @steggy for advise !

Can you please specify importer? Till now I use in Neo4j desktop below statement to create tables:

// Create products
LOAD CSV WITH HEADERS FROM 'file:///products.csv' AS row
MERGE (product:Product {productID: row.ProductID})
  ON CREATE SET product.productName = row.ProductName, product.unitPrice = toFloat(row.UnitPrice);

// Create suppliers
LOAD CSV WITH HEADERS FROM 'file:///suppliers.csv' AS row
MERGE (supplier:Supplier {supplierID: row.SupplierID})
  ON CREATE SET supplier.companyName = row.CompanyName;

// Create categories
LOAD CSV WITH HEADERS FROM 'file:///categories.csv' AS row
MERGE (c:Category {categoryID: row.CategoryID})
  ON CREATE SET c.categoryName = row.CategoryName, c.description = row.Description;

Is there any other possibility - to create tables without above statement?

And to create relation bettwen them ?

Above statement will be problematic if i will upload over 100 tables in csv..

Thank you in advance !

steggy
Neo4j
Neo4j

Have a look at this class in Graph Academy