产品和评论系统的维度建模

Posted

技术标签:

【中文标题】产品和评论系统的维度建模【英文标题】:Dimensional Modelling for Product and review system 【发布时间】:2019-11-05 11:42:01 【问题描述】:

我遇到了以下场景,我需要将 OLTP 数据库系统转换为维度建模或 DWH 系统。

我从源代码中收到了两个 JSON 格式的文件。它确实有产品和评论者的详细信息。 Product : ID , name , price , urlofproduct ,relatedproducts ,salesrank, brand, categories

Product data sample :

  "ID": "0000031852",
  "name": "Girls Ballet Tutu Zebra Hot Pink",
  "price": 3.17,
  "urlofproduct ": "http://ecx.images-amazon.com/images/I/51fAmVkTbyL._SY300_.jpg",
  "relatedproducts ":
  
    "also_bought": ["B00JHONN1S", "B002BZX8Z6", "B00D2K1M3O", "0000031909"],
    "also_viewed": ["B002BZX8Z6", "B00JHONN1S", "B008F0SU0Y", "B00D23MC6W", "B00AFDOPDA"],
    "bought_together": ["B002BZX8Z6"]
  ,
  "salesRank": "Toys & Games": 211836,
  "brand": "Coxlures",
  "categories": [["Sports & Outdoors", "Other Sports", "Dance"]]

审阅者:ID、ProductID、姓名、有用、reviewtext、整体、摘要、unixreviewtime、reviewtime

审稿人样本数据:


  "ID": "A2SUAM1J3GNN3B",
  "ProductID": "0000013714",
  "Name": "J. McDonald",
  "helpful": [2, 3],
  "reviewText": "I bought this for my husband who plays the piano.  He is having a wonderful time playing these old hymns.  The music  is at times hard to read because we think the book was published for singing from more than playing from.  Great purchase though!",
  "overall": 5.0,
  "summary": "Heavenly Highway Hymns",
  "unixReviewTime": 1252800000,
  "reviewTime": "09 13, 2009"

我正在努力对其进行维度建模。我可以看到产品和评论者是两个维度。 但是我应该如何将购买、查看或一起购买的相关产品存储在我的数据仓库中。

任何人都可以帮助解决这个问题。只是给出一些想法如何进行。

【问题讨论】:

【参考方案1】:

如果您使用的是 MS SQL Server,那么您可以尝试使用 OPENJSON (SQL Server) 函数。此功能允许解析和转换 JSON 数据。

【讨论】:

以上是关于产品和评论系统的维度建模的主要内容,如果未能解决你的问题,请参考以下文章

数据仓库维度建模法案例

维度建模实践一例 维度还是事实

维度建模实践一例 维度还是事实

维度建模疑点

维度建模(星型雪花星座)

对于维度建模的理解