一对多查找,转换为一对一维度

One to many lookup, converted to a one to one dimension

我正在努力弄清楚如何将一对多 table 结构从事务数据库转换为数据仓库的一对一维度。

交易数据库中的数据结构为:

根记录 (Parent_ID)

查询 Table "Many Parent_IDs" (Patent_ID, Child_ID)

引用Table(Child_ID,姓名)

加入我的参考 table 带回一个看起来像这样的数据集:

╔═════════════╦═══════════╦══════════╦════════════╗
║ Root_ID     ║ Root_Code ║ Child_ID ║ Child_Name ║
╠═════════════╬═══════════╬══════════╬════════════╣
║           1 ║ 1000      ║       22 ║  Name 1    ║
║           1 ║ 1000      ║       23 ║  Name 2    ║
║           1 ║ 1000      ║       24 ║  Name 3    ║
║           1 ║ 1000      ║       25 ║  Name 4    ║
║           2 ║ 1150      ║       67 ║  Name 5    ║
║           2 ║ 1150      ║       68 ║  Name 6    ║
║           2 ║ 1150      ║       69 ║  Name 7    ║
║           3 ║ 2019      ║       11 ║  Name 8    ║
║           3 ║ 2019      ║       12 ║  Name 9    ║
║           5 ║ 2010      ║       91 ║  Name 10   ║
║           5 ║ 2010      ║       92 ║  Name 11   ║
║           5 ║ 2010      ║       93 ║  Name 12   ║
║           5 ║ 2010      ║       94 ║  Name 13   ║
║           5 ║ 2010      ║       95 ║  Name 14   ║
║           5 ║ 2010      ║       96 ║  Name 15   ║
║           6 ║ 5010      ║       33 ║  Name 16   ║
╚═════════════╩═══════════╩══════════╩════════════╝

我在我的维度中所追求的是要知道,Root_ID (1) 具有 Child_ID(22,23,24,25) 的值,并且能够使用在维度上生成的键。

Keep in mind I can never predict how many child records there will be, so creating X about of columns in my dimension isn't an option.

我相信比我聪明的数据仓库头脑知道这通常是如何处理的。

说明想要的结果:

事实记录(Dimension_Root_Key = 1)

维度(键 1、名称 1、名称 2、名称 3、名称 4)

原来我应该多学一点。我学会了 "Bridging" 表的命名法。

知道 kimball 小组有一些关于如何实现我想要的东西的很棒的演示。进一步阅读 Bridging tables