Skip to content

Instantly share code, notes, and snippets.

@kamath
Created March 29, 2021 16:53
Show Gist options
  • Save kamath/cfde4ccf1b68bf46b523c9cc9c4bff0a to your computer and use it in GitHub Desktop.
Save kamath/cfde4ccf1b68bf46b523c9cc9c4bff0a to your computer and use it in GitHub Desktop.
LOAD CSV WITH HEADERS FROM "file:///styles.csv" AS row
MERGE (sc:SubCategory {name: coalesce(row.subCategory, "unknown")})
MERGE (mc:MasterCategory {name: coalesce(row.masterCategory, "unknown")})
MERGE (g:Gender {name: coalesce(row.gender, "unknown")})
MERGE (y:Year {name: coalesce(row.year, "unknown")})
MERGE (t:ArticleType {name: coalesce(row.articleType, "unknown")})
MERGE (b:BaseColor {name: coalesce(row.baseColour, "unknown")})
MERGE (s:Season {name: coalesce(row.season, "unknown")})
MERGE (p:Product {name: row.productDisplayName, id: row.id})
MERGE (p)-[:HAS_SUB_CATEGORY]->(sc)
MERGE (p)-[:HAS_MASTER_CATEGORY]->(mc)
MERGE (p)-[:HAS_GENDER]->(g)
MERGE (p)-[:HAS_YEAR]->(y)
MERGE (p)-[:HAS_ARTICLE_TYPE]->(t)
MERGE (p)-[:HAS_BASE_COLOR]->(b)
MERGE (p)-[:HAS_SEASON]->(s)
RETURN count(p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment