å ¥åããŒã¿
ç§ã®ã¯ã©ã€ã¢ã³ãã¯ãMicrosoft SQL Server 2012 Business Intelligence Editionã«åºã¥ããBIãœãªã¥ãŒã·ã§ã³ã䜿çšããŠããŸãã ãã®BIã·ã¹ãã ã®äžå¿ã¯ããã©ã³ã¶ã¯ã·ã§ã³ã·ã¹ãã ïŒ OLTP ïŒããã®SSISããã±ãŒãžã䜿çšããŠäœæãããããŒã¿ãŠã§ã¢ããŠã¹ã§ãã ããŒã¿ãŠã§ã¢ããŠã¹ã¯ã å€æ¬¡å ããŒã¿ã¢ãã«ã®ãœãŒã¹ãšããŠæ©èœããŸãã å€æ¬¡å ããŒã¿ã¢ãã«ã«åºã¥ããŠã顧客åæã¯ããããããŒãã«ã䜿çšããŠExcelã§ã¬ããŒããçæããŸãã å€ãã®ããŒã¿ãœãŒã¹ãããããã©ã³ã¶ã¯ã·ã§ã³ã·ã¹ãã ã®ãŠãŒã¶ãŒããã£ã¬ã¯ããªãã©ã³ãã ã«æäœããããã顧客ã¯ãåæåæã®ç®çã«äŸ¿å©ãªããŒã¿ãŠã§ã¢ããŠã¹ã®äžéšã®ãã£ã¡ã³ã·ã§ã³ã®éå±€ãäœæã§ãããœãªã¥ãŒã·ã§ã³ã®å¿ èŠæ§ã瀺ããŸããã ããšãã°ãOLTPã·ã¹ãã ããã€ã³ããŒãããããDepartmentsããã£ã¡ã³ã·ã§ã³ïŒããŒãã«dbo.dimDivisionsïŒã«ä¿åãããŠããäŒç€Ÿã®çµç¹æ§é ã«é¢ããæ å ±ã¯ãOLTPã·ã¹ãã ã§çæãããéçšã¬ããŒãã«ã¯äŸ¿å©ã§ãããBIã·ã¹ãã ã§ã®åæã«ã¯é©ããŠããŸããã
ããžãã¹èŠä»¶
æ³äººé¡§å®¢ã®æ£åŒãªèŠä»¶ã¯ã次ã®ããã«ç°¡åã«èª¬æã§ããŸãã
- åæã¬ããŒãã®ç®çã§äŒç€Ÿã®éšéã®ããŒã¿ã管çã§ããããŒã«ãéçºããã
- æ¢åã®BIãœãªã¥ãŒã·ã§ã³ã§æ°ããããžãã¹ãŠãããæ å ±ã䜿çšããŸãã
- å€æŽãOLTPã·ã¹ãã ã®åäœã«åœ±é¿ãäžããããšã¯ãããŸããã
äºåè©äŸ¡ãšææ決å®ã®éžæ
å©çšå¯èœãªå ¥åããŒã¿ãšããžãã¹èŠä»¶ã«åºã¥ããŠã顧客ã¯æ¬¡ã®ãœãªã¥ãŒã·ã§ã³ãæäŸãããŸããã
- ããŒã¿ãŠã§ã¢ããŠã¹ã«è¿œå ã®ãã£ã¡ã³ã·ã§ã³ãè¿œå ããŠãçµç¹ã«é¢ããããŒã¿ãä¿åããŸãã åæã¬ããŒãç®çã®æ§é ã
- æ°ãããã£ã¡ã³ã·ã§ã³ã®ã¬ã³ãŒããšãåŸæ¥å¡ããã£ã¡ã³ã·ã§ã³ã®éã®ãªã³ã¯ãæäŸããŸãã
- ããŒã¿ãŠã§ã¢ããŠã¹ã®æ§é ã®å€æŽãåæ ããããã«ãå€æ¬¡å ããŒã¿ã¢ãã«ãå€æŽããŸãã
- ãã¹ã¿ãŒããŒã¿ãµãŒãã¹ãèšå®ããŸãã èšå®ãšã¯ãåŸæ¥å¡ãšéšéã«é¢ããããŒã¿ãæåã§å ¥åããã³ç·šéããæ©èœã®äœæãããã³MSDãšã®éã§ããŒã¿ãã€ã³ããŒã/ãšã¯ã¹ããŒãããããã«å¿ èŠãªèšå®ãæå³ããŸãã
- ããŒã¿ãŠã§ã¢ããŠã¹ããMaster Data Servicesãžã®æ°ããåŸæ¥å¡ã«é¢ããããŒã¿ã®èªåã€ã³ããŒããæäŸããŸãã
- ãã¹ã¿ãŒããŒã¿ãµãŒãã¹ããããŒã¿ãŠã§ã¢ããŠã¹ãžã®éšéããã³åŸæ¥å¡æå±ã®ããŒã¿ã®èªåãšã¯ã¹ããŒããåŸæ¥å¡ã«æäŸããŸãã
ãœãªã¥ãŒã·ã§ã³ã®å®è£
ããŒã¿ãŠã§ã¢ããŠã¹ã®æ¹è¯
ããã§ã¯ãé çªã«è¡ããŸãããã ãŸããããŒã¿ãŠã§ã¢ããŠã¹ïŒdbo.dimDerivedDivisionsïŒã«æ°ãããã£ã¡ã³ã·ã§ã³ãä»»æåäœããäœæããããããåŸæ¥å¡ããã£ã¡ã³ã·ã§ã³ïŒdbo.dimEmploeesïŒã«é¢é£ä»ããŸãã ãã®ã¿ã¹ã¯ã®SQLã¹ã¯ãªããã¯æ¬¡ã®ãšããã§ãã
-- " " CREATE TABLE dbo.dimDerivedDivisions ( id int NOT NULL primary key identity(1, 1), parentId int NULL, sourceCode int NOT NULL, sourceParentCode int NULL, name nvarchar(100) NOT NULL DEFAULT ('N/A'), lineageDate datetime DEFAULT GETDATE(), lineageSource nvarchar(255) NOT NULL DEFAULT ('') ); -- parentId, dbo.dimDerivedDivisions(id) - ALTER TABLE dbo.dimDerivedDivisions ADD CONSTRAINT fk_dbo_dimDerivedDivisions_dbo_dimDerivedDivisions FOREIGN KEY (parentId) REFERENCES dbo.dimDerivedDivisions(id); -- , SET IDENTITY_INSERT dbo.dimDerivedDivisions ON; INSERT INTO dbo.dimDerivedDivisions (id, parentId, sourceCode, sourceParentCode, name, lineageDate, lineageSource) SELECT 0, NULL, 0, NULL, 'N/A', GETDATE(), ' ' WHERE NOT EXISTS (SELECT id FROM dbo.dimDerivedDivisions WHERE id = 0); SET IDENTITY_INSERT dbo.dimDerivedDivisions OFF; -- "" ALTER TABLE dbo.dimEmployees ADD derivedDivisionId int NOT NULL DEFAULT(0); -- , dbo.dimDerivedDivisions(id) ALTER TABLE dbo.dimEmployees ADD CONSTRAINT fk_dbo_dimEmployees_dbo_dimDerivedDivisions FOREIGN KEY (derivedDivisionId) REFERENCES dbo.dimDerivedDivisions(id);
å€æ¬¡å ããŒã¿ã¢ãã«ã®æ¹è¯
次ã«ãæ°ãããã£ã¡ã³ã·ã§ã³ãå€æ¬¡å ããŒã¿ã¢ãã«ã«è¿œå ããŸãã ãããè¡ãã«ã¯ãSQL Server Data Toolsã§å€æ¬¡å ããŒã¿ã¢ãã«ãããžã§ã¯ããéããæ°ããdbo.dimDerivedDivisionsããŒãã«ãããŒã¿ãœãŒã¹ãã¥ãŒã«è¿œå ããŸãã çµæã¯æ¬¡ã®ãšããã§ãã
ãã®ãããã¯ããé ããªãããã«ãå€æ¬¡å ã¢ãã«ãå®æãããããã»ã¹ãç°¡åã«èª¬æããŸãã å€æ¬¡å ããŒã¿ã¢ãã«ã§ã¯ãæ°ãããã£ã¡ã³ã·ã§ã³ãä»»æã®éšéããäœæãããEmployeesããã£ã¡ã³ã·ã§ã³ãä»ããŠæ°ãããã£ã¡ã³ã·ã§ã³ãšæ¢åã®ãã¡ã¯ãããŒãã«ãšã®æ¥ç¶ãæ§æãããã¥ãŒããå±éããã³åŠçããŸãã
ãã¹ã¿ãŒããŒã¿ãµãŒãã¹ãæ§æãã
æ°ãããã£ã¡ã³ã·ã§ã³ãã«ã¹ã¿ã 枬å®ãã®ã³ã³ããã¹ãã§åæã¬ããŒããäœæããããã®ãã¹ãŠã®ããŒã¿æ§é ã®æºåãã§ããã®ã§ãæãéèŠãªããšã«é²ã¿ãŸã-ãã¹ã¿ãŒããŒã¿ãµãŒãã¹ãèšå®ããŸãã ãããè¡ãã«ã¯ããã©ãŠã¶ã§ãSQL Server管çè ããæäŸããããªã³ã¯ãã¯ãªãã¯ãã次ã®ãããªMDS Webã€ã³ã¿ãŒãã§ã€ã¹ã«ã¢ã¯ã»ã¹ããŸãã
Master Data Servicesã®ã€ã³ã¹ããŒã«ã«ã€ããŠã¯ã msdn.microsoft.comã§è©³çŽ°ã«èª¬æãããŠããæ¥åžžçãªã¿ã¹ã¯ã§ãããããããã§ã¯èª¬æããŸããã MDSã®å®éã®äœ¿çšã«ããçŠç¹ãåœãŠãŠããŸãã
ãããã£ãŠãæåã«è¡ãå¿ èŠãããã®ã¯ã¢ãã«ã®äœæã§ãã MDSã®ã¢ãã«ã¯ãç¹å®ã®ããžãã¹ãšãªã¢ã®ãšã³ãã£ãã£ãå«ãè«çã³ã³ããã§ãã ãã®å Žåããšã³ãã£ãã£ãåŸæ¥å¡ããšããŠãããããå«ããåŸæ¥å¡ãã¢ãã«ãäœæããã®ãé©åã§ãã ã¢ãã«ãäœæããã«ã¯ã[ã·ã¹ãã 管ç]ãªã³ã¯ã䜿çšããŠããã¹ã¿ãŒããŒã¿ãµãŒãã¹Webã€ã³ã¿ãŒãã§ã€ã¹ã®ç®¡çã¿ã¹ã¯ã«ç§»åããŸãã éãããŠã£ã³ããŠã§ãåŸæ¥å¡ã¢ãã«ã®ååãå ¥åããã¢ãã«ã®ä¿åãã¿ã³ãã¯ãªãã¯ããŸãã
[ã¢ãã«ãšåãååã®ãšã³ãã£ãã£ãäœæãã]ãã§ãã¯ããã¯ã¹ããªã³ã«ãããšãåãååã®Employeesãšã³ãã£ãã£ãã¢ãã«ãšãšãã«èªåçã«äœæãããŸãã 次ã«ãå¥ã®ãšã³ãã£ãã£ãDivisionsããäœæããŸãããã®ããã«ãEmployeesã¢ãã«ãéžæããManage-Entitiesã¡ãã¥ãŒã«ç§»åããŸãã
[ãšã³ãã£ãã£ã®è¿œå ]ãã¿ã³ãã¯ãªãã¯ããŸãã
éãããã€ã¢ãã°ã§ãæ°ãããšã³ãã£ãã£ã®ãã©ã¡ãŒã¿ãå ¥åãã[ãšã³ãã£ãã£ãä¿å]ãã¿ã³ãã¯ãªãã¯ããŸãã ãçµç¹åäœããšã³ãã£ãã£ãäœæãããšãã«ã[æ瀺çãªéå±€ãšã³ã¬ã¯ã·ã§ã³ãæå¹ã«ãã]ãã§ãã¯ããã¯ã¹ããªã³ã«ãªã£ãŠããããšã«æ³šæããŠãã ããïŒããã¯ããšã³ãã£ãã£ã®éå±€ãäœæã§ããããšãæå³ããŸãïŒãäžã®éšééå±€ã®ååã瀺ããŸãã æ瀺çéå±€ã¯ãã¡ã³ããŒãä»»æã®æ¹æ³ã§ç·šæã§ããéå±€ã§ãã éå±€ã®åã¬ãã«ã«ã¯ãä»»æã®æ°ã®ã¡ã³ããŒãšæ¬¡ã®ã¬ãã«ã®ãã¹ãããããŸãã
ãšã³ãã£ãã£ãäœæãããããšã³ãã£ãã£ã®å±æ§ãæ§æããå¿ èŠããããŸãã ãšã³ãã£ãã£ãEmployeesãã«å¯ŸããŠãå±æ§ãDivisionãïŒDivisionïŒãè¿œå ããŸãã Employeesãšã³ãã£ãã£ãéžæãã[éžæãããšã³ãã£ãã£ãç·šé]ãã¿ã³ãã¯ãªãã¯ããŸãã
éããŠãããšã³ãã£ãã£ç·šéãã©ãŒã ã§ãããªãŒãå±æ§ã®è¿œå ããã¿ã³ãã¯ãªãã¯ããŠããåŸæ¥å¡ããšã³ãã£ãã£ã®æçµèŠçŽ ã®ããã£ããžã§ã³ãå±æ§ãè¿œå ããŸãã
å±æ§ãè¿œå ããããã«éãããã©ãŒã ã§ãå±æ§ã®ååãå ¥åããå±æ§ã¿ã€ãã¹ã€ããããã¡ã€ã³ããŒã¹ã«èšå®ããŸãã ããã¯ããã®å±æ§ã®å€ãç¹å®ã®ãšã³ãã£ãã£ã«å±ããããšãæå³ãã以äžã§ã¯ã©ã®ãšã³ãã£ãã£ããã®å Žåã¯ãéšéãã®æ¬è³ªã§ãããã瀺ããŸãã æåŸã«ã[å±æ§ãä¿å]ãã¿ã³ãã¯ãªãã¯ããŸãã
Master Data Servicesã§ã®æåããŒã¿å ¥å
ãããã£ãŠãã¢ãã«ãEmployeesããšãšã³ãã£ãã£ãEmployeesãããã³ãDivisionsãã®æºåãã§ããã®ã§ããããã«ããŒã¿ãå ¥åããå¿ èŠããããŸãã ãŠãŒã¶ãŒã¯ãšã³ãã£ãã£ãDivisionsãã«æåã§å ¥åããŸãã ãã®ããã»ã¹ã瀺ãããã«ãMaster Data Services Webã€ã³ã¿ãŒãã§ã€ã¹ã®ã¡ã€ã³ããŒãžã«ç§»åããInformation Worker Tasksãµãã»ã¯ã·ã§ã³ã§Employeesã¢ãã«ãéžæããŠããšã¯ã¹ãããŒã©ãŒãªã³ã¯ããã©ããŸãã
éå±€ãéšéããéžæããŸãã
å¶åŸ¡ããèŠçŽ ã®ã¿ã€ããéžæããŸãã æåã«ãçµ±åã¡ã³ããŒãäœæããŸãã
[è¿œå ]ãã¿ã³ãæŒãããŠãããã°ã«ãŒããå¶æ¥éšãã®ååãå ¥åããŠã[OK]ãã¿ã³ãæŒããŸãã
åæ§ã«ã次ã®å³ã«ç€ºãããã«ãä»ã®ãŠããããè¿œå ããŠããŠãããã®æ§é ãäœæããŸãã
éšéã°ã«ãŒãã¯å€ªåã§ããŒã¯ãããæéèŠçŽ ã¯å€ªåã§ããŒã¯ãããŠããããšã«æ³šæããŠãã ããã éå±€ã®1ã€ã®ã¬ãã«ã«ã¯ããããã®èŠçŽ ãšä»ã®ã¿ã€ãã®èŠçŽ ã®äž¡æ¹ãå«ããããšãã§ããŸãã
Master Data Servicesãžã®ããŒã¿ã®ã€ã³ããŒã
次ã«ãæ¢åã®ããŒã¿ãŠã§ã¢ããŠã¹ããåŸæ¥å¡ããŒã¿ããã¹ã¿ãŒããŒã¿ãµãŒãã¹ã«ã€ã³ããŒãããå¿ èŠããããŸãïŒåŸæ¥å¡ãšéšéãããã«æ¯èŒãããã®ããŒã¿ããŠã§ã¢ããŠã¹ã«ãšã¯ã¹ããŒãããããïŒã ãã¹ã¿ãŒããŒã¿ãµãŒãã¹ãæäŸããSQLããŒã¿ããŒã¹ã«MDSã«ããŒã¿ãããŒãããããã«ãSQLã¯ãšãªã§ããŒã¿ãæ¿å ¥ãããããªããžããªããæ°ããåŸæ¥å¡ã¬ã³ãŒããã€ã³ããŒãããç¹å¥ãªSSISããã±ãŒãžãäœæãããã§ããç¹å¥ãªã¹ããŒãžã³ã°ããŒãã«ããããŸããã¹ã¿ãŒããŒã¿ãµãŒãã¹ã§ããã«åŠçããããã®äžæããŒãã«ãžã®ããŒã¿ã SSMSãéããMaster Data ServisesããŒã¿ããŒã¹ã§äžæããŒãã«ãèŠã€ããŸãã ããã«ãããŸãïŒ
äŸãšããŠãä»»æã®10人ã®åŸæ¥å¡ã¬ã³ãŒããããŒã¿ãŠã§ã¢ããŠã¹ããMaster Data ServicesããŒã¿ããŒã¹ã®äžéããŒãã«ã«ã€ã³ããŒãããŸãã ãããè¡ãã«ã¯ã次ã®SQLã¯ãšãªãå®è¡ããŸãã
INSERT INTO [stg].[Employees_Leaf] ([ImportType], [ImportStatus_ID], [BatchTag], [Code], [Name]) SELECT TOP 10 1, 0, N'Employees_Leaf_Batch00001', E.id, E.name FROM [DW].[dbo].[dimEmployees] E;
Master Data Servicesã®Webã€ã³ã¿ãŒãã§ã€ã¹ã«æ»ããã¡ã€ã³ããŒãžã§[çµ±å管ç]ãªã³ã¯ã«ç§»åããŸãã
éãããŠã£ã³ããŠã«ãSQLã¯ãšãªã«ãã£ãŠäœæãããã°ããã®ããã±ãŒãžEmployees_Leaf_Batch00001ã衚瀺ãããŸãã [ãããã®éå§]ãã¿ã³ãã¯ãªãã¯ããŠå®è¡ããŸãã
ããã±ãŒãžãäœæãããšãã¹ããŒã¿ã¹ãéå§æå»ãšçµäºæå»ããšã©ãŒã«é¢ãã次ã®ãããªæ å ±ã衚瀺ãããŸãã
ãã¹ã¿ãŒããŒã¿ãµãŒãã¹ã®ããŒã¿ç®¡ç
ããã§ã¯ãããŒã¿ç®¡çã¢ãŒãã«å ¥ããã¹ããŒãžã³ã°ããŒãã«ã®åŸæ¥å¡ã¬ã³ãŒããã©ã®ããã«ããŒããããããèŠãŠã¿ãŸãããã ãããè¡ãã«ã¯ããã¹ã¿ãŒããŒã¿ãµãŒãã¹Webã€ã³ã¿ãŒãã§ã€ã¹ã®ã¡ã€ã³ããŒãžã®[ã€ã³ãã©ã¡ãŒã·ã§ã³ã¯ãŒã«ãŒã¿ã¹ã¯]ãµãã»ã¯ã·ã§ã³ã§ãåŸæ¥å¡ã¢ãã«ãéžæãã[ãšã¯ã¹ãããŒã©ãŒ]ãªã³ã¯ãã¯ãªãã¯ããŸãã éãããŠã£ã³ããŠã§ãæ°ããåŸæ¥å¡ããŒã¿ãMaster Data Servicesã«è¿œå ãããæ€èšŒåŸ ã¡ç¶æ ã«ãªã£ãŠããããšãããããŸãã
åŸæ¥å¡ã®éšéïŒéšéïŒã«é¢ããããŒã¿ã¯å ¥åãããŠããªãããšã«æ³šæããŠãã ããã ååŸæ¥å¡ã«ã€ããŠã圌ãåããŠããéšéãéžæãã[OK]ãã¿ã³ãã¯ãªãã¯ããå¿ èŠããããŸãã
Master Data ServicesããããŒã¿ããšã¯ã¹ããŒããã
éšéããã³éšéãžã®åŸæ¥å¡ã®æå±ã«é¢ããããŒã¿ãå ¥åããããããããããŒã¿ãŠã§ã¢ããŠã¹ã«ã€ã³ããŒããçŽãå¿ èŠããããŸãã ãããè¡ãã«ã¯ãMDSã§ãµãã¹ã¯ãªãã·ã§ã³ãã¥ãŒãäœæããŸãã Master Data Services Webã€ã³ã¿ãŒãã§ã€ã¹ã®ã¡ã€ã³ããŒãžã®[管çã¿ã¹ã¯]ãµãã»ã¯ã·ã§ã³ã§ã[çµ±å管ç]ãªã³ã¯ã«ç§»åããŸãã
éãããŠã£ã³ããŠã§ã[ãã¥ãŒã®äœæ]ã¡ãã¥ãŒã«ç§»åãã[ãµãã¹ã¯ãªãã·ã§ã³ãã¥ãŒã®è¿œå ]ãã¿ã³ãã¯ãªãã¯ããŸãã
ãšã³ãã£ãã£ãDivisionsãã®ãã¬ãŒã³ããŒã·ã§ã³ãã©ã¡ãŒã¿ãå ¥åãã[ä¿å]ãã¿ã³ãã¯ãªãã¯ããŸãã
åæ§ã«ãEmployeesãšã³ãã£ãã£ã®ãã¥ãŒãäœæããŸãã
ããã§ã¯ãã©ã®ãããªè¡šçŸãã©ã®ããã«äœ¿çšãããã®ããèŠãŠã¿ãŸãããã å®éããã¹ãŠãéåžžã«åçŽã§ãããMDSã®ãã¥ãŒã¯SQLããŒã¿ããŒã¹ã®éåžžã®ãã¥ãŒã«ãããŸããã SSMSãéããŠãããã確èªããŠã¿ãŸãããã
ãããŠããã®åé¡ã解決ããããã«æåŸã«ãã¹ãããšã¯ãMDSãã¥ãŒããããŒã¿ãŠã§ã¢ããŠã¹ã«æ å ±ããšã¯ã¹ããŒãããSQLã¹ã¯ãªãããŸãã¯SSISããã±ãŒãžãéçºããããšã§ãã
çµè«
ãã®ãœãªã¥ãŒã·ã§ã³ã®å®è£ ã«çŽ8æéãè²»ãããŸããããããã¯ãã®ãããªã¿ã¹ã¯ã«ååãªæéã ãšæããŸãã 説æãããœãªã¥ãŒã·ã§ã³ã§ã¯ãMaster Data Servicesã®ãã¹ãŠã®æ©èœã䜿çšããŸããã§ãããããšãã°ãMDSãžã®ã€ã³ããŒãæã«ããŒã¿ãã¯ãªã¢ããããã«äœ¿çšã§ããBusiness Rulesãç¡èŠããŸããã ãããã顧客ãå µåšåº«ã«æ°ãããããªãã·ã³ãã«ãªãåæã«æè»æ§ã®ããããŒã«ã§ããMaster Data Servicesãæã£ãŠããããšã¯æ確ãªãã©ã¹ã ãšèããŠããŸããããã¯ãåç §NSIã®åŠçãšä¿åã«é¢é£ããã¿ã¹ã¯ãå°æ¥çã«è§£æ±ºããã®ã«åœ¹ç«ã¡ãŸãã