Building metadata models using Framework Manager can be a simple or complex one. It all depends on the underlying database structure and how relevant it is to the reporting that is required. Regardless of the data model complexity there are a number of best practices that should be followed when building models using Framework Manager:
- Never allow Cognos to create joins automatically when importing data sources. Cognos rarely chooses correctly and this inevitably creates future rework. Creating joins manually gives full control and avoids cardinality and join issues.
- Always separate your model into the following three namespaces. Separating into three layers may seem difficult initially, but this organization makes the model easier to maintain. If the underlying data structures change, you will only need to reflect these changes in a single location.
- Database Layer Namespace – This namespace simply contains all the query subjects brought in from your data source. No joins or renaming of query items occur in this layer. By leaving this layer untouched, future model changes will only need to be changed in this layer. All other layers can remain untouched.
- Logical Layer Namespace – Relationships between query subjects should be created in this layer. If query subjects need to be merged, the merge should be created here. Any model filters should be applied and query subjects and query items should be translated to business names in this layer. All query subjects in the Logical layer should reference back to the database layer.
- Presentation Layer Namespace – This layer contains shortcuts to the logical namespace and organizes the data for the business user.
- Assign query usage in the database layer. Understanding the query usage property and setting it in this layer will ensure that it is always set correctly throughout the rest of the model. Each query subject that is created from the base layer will inherit these properties.
- Never expose query subjects to the user that could result in cross product query. As an additional precaution, use the governor setting to deny cross product queries.
- Use the governor settings to limit the query execution time. This will prevent users from developing run-away queries that can impact database performance.
- Maintain a history of your models using a source control system. Framework Manager has direct connections to Visual SourceSafe and CVS- be sure to take advantage of this feature. CVS is an open source versioning system so cost should not be an excuse!.
- When modeling your data, avoid creating situations where multiple join paths or loop joins can occur. To prevent these situations, try aliasing the query subject multiple times to force a single path through the data.
- If possible, try to model in a star/snowflake schema. In a perfect world, this is done for you in the data model and the underlying ETL processes, but in reality we rarely get this lucky. It is possible to create a virtual star schema by merging query subjects to de-normalize data and creating new query subjects that contain only measures. The drawback of this method is that there can be significant performance impacts. Understanding the queries that are being created against the data is critical to making a good design decision here.
- Set security at the highest level allowable, starting with the package, then the object and if needed the data. Applying security at a high level and then drilling down to more detailed security levels will save maintenance and troubleshooting time. Keep security as simple as possible while still meeting the security requirements and you will thank yourself at the end of the day.
- Use data level security settings in Framework Manager only when absolutely necessary. Data security is a powerful feature but maintenance and troubleshooting with row level security become complex quickly. If you must use it, make sure to have it well documented for future developers and administrators. If you do choose to use data level security, be aware that it supercedes all other security settings in Cognos Connection.
- Check cardinality for accuracy and test cardinality to make sure it is behaving as expected. Avoid many to many relationships in your model. If you cannot avoid them, organize data so that the user is less likely to create a report with a many to many relationship.
- Name query subjects and query items using business terms. As simple as this seems, many organizations leave the original table and column names, creating confusion for the end user.
- Only publish data that is in the presentation layer, and only expose query subjects that are useful for the end user.
- Document the model. This is another simple task that is often overlooked,or more likely skipped to save time. Even if the model developer will be maintaining the model, six months from deployment the developer will not remember all the details of the model. Proper documentation expedites making future changes and fixing bugs Document each layer, the joins associated, and any calculations or merges that were done.
By following these best practices, you will build a model with documentation that allows for better maintenance and support. You will spend more time upfront building the model, but when changes inevitably occur, it will be well worth the effort. If you have other best practices you would like to share, please send them to me at email@example.com I will publish them here in a follow up post.