Beginning MDS – Getting at the Data with TSQL (Part 7 of 7)
OK, so we’ve created the objects and loaded data into them. Now we can have a closer look at what has happened to the MDS database. What has been built? Where is the data stored?
The aim of this final post is to get you started towards locating your data stored in the MDS repository database. There are plenty of ways to get at the data but we’re going to just take a quick peek at accessing the data via TSQL. Remember that TSQL isn’t the only way to get at this data. I just haven’t had much of a chance to have a detailed look at the MDS web service and API yet.
Walkthrough
So where’s our Geography model data? Let’s start by finding the identifier of the model itself.
Note that there are a number of different metadata UDFs that can return scalar and tabular data for a variety of things such as model ID, I’m just going to do it the manual way for the purposes of demonstration.
Armed with the model ID we can take a look at the Entities defined within that model.
- EN = Entity
- MS = Security
- HR = Hierarchy
- HP = Hierarchy Parent
- CN = Collection
- CM = Collection Member
The MDS engine builds tables to store data for the objects that are created within models. Here is a list of all the tables created as a result of our efforts with the Geography (ID = 15) model.
Have a look inside the table that contains the records for the City entity, remembering that your own IDs (both for the model and the entity) will vary from mine.
Notice the uda_CAAPFLF reference in the TableColumn column for StateProvince. This provides a reference back to the column that links the StateProvince attribute to the City entity.
On top of the system-generated-model-centric tables that MDS generates there are also system views that already do much of the heavy lifting for you when it comes to getting at the data. Here are the views that MDS created by the Geography model objects.
Based on what we have built the most useful views are the …CHILDATTRIBUTES ones. These will return the records within a particular entity including all the attributes that have been defined on it.
All the human readable data is located at the far end of the table, so remember to scroll all the way to the right.
Note the friendly column names that have been created as part of the view definition.
If you want to look at the parent/child metadata that was defined as a result of the derived hierarchy we created look at the contents of the …PARENTCHILD_DERIVED views.
Hopefully this whirlwind tour of the MDS repository DB has been enough to pique your interest. Take time to explore the inner workings of the database and find all the good stuff that is baked into the product and how you can leverage it.
This post also marks the end of this series of walkthroughs, hope they were useful.
10 comments:
Hi Nick
I am a bit curious about you wanting to dig into the tables inside MDS. Have seen some other posts around the place wanting to do the same thing. I always understood one of the key aspects of a product such as this was to protect us from these complexities and protect itself from those wanting to fiddle under the hood where they can perhaps cause some damage. The views provided by the product (which have progressively increased in number and variety through the +EDM versions) should cover most requirements.
Otherwise, I am glad to see MDS getting some exposure. Over the last few years (with +EDM) we have seen several cases of politics and people getting in the way - particularly some IT bods who wanted to do it all their own way and not let users anwyhere near the master data.
On another front, I don't think MDS is as immature a product as some might think. It started as a dimension management tool to support cubes before the broader application became obvious. +EDM was at version 4 just before becoming MDS, and prior to that was recognised as one of the major players in a field of 5 or 6 products. It has just been hard to spot for a couple of years while being transformed into MDS.
Also wondering if the old +EDM manuals and training material will be re-jigged for MDS - might save you some typing :)
Looking forward to seeing a lot more appearing about MDS in use for specific business issues.
Cheers
Thank you very much for this post. I actually found it much more helpful to understand than the EDM documentation/training manuals that I've seen.
Glad you found it useful :)
As an EDM user i am very happy for these blogs.
Some thinks are very familiar, other are interesting new concepts.
Waiting to find more.
Thanks for the info you have forwarded..
Hi Nick,
It was a wonderful article on MDS to start with. I have a question. Can I insert or update data into the tables of the source database through MDM?
Thanks,
Roy
"source database" - do you mean the MDS repository database or another separate DB?
NB
Seperate database, the database from where we are pulling the records, eg. AdventureWorksDW2008R2 database. Also, I need to know how Export option is performed.
Thanks.
You can export model data from within the Management UI.
As for updating an external DB this is something you would want to explore the MDS API - it would be a custom dev effort on your part.
Thanks Nick. I'll have a look at it.
Hi Nick,
Very good article thank you. I found when digging into mdm.tblAttribute - instead of DataType_ID = 1, shouldn't it read AttributeType_ID = 1 to filter for user defined attributes?
Kevin Pickering
Post a Comment