Configuring the OlapPartitionManager

To get yourself up and running with the OlapPartitionManager this is all you have to do:
  1. Edit the OlapPartitionManager.exe.Config file to change the database connection string and identify the OlapServerType (i.e. DEV, UAT or PROD).
  2. Change the OlapDateDimWrapper view to work with your own date dimension table or equivalent
  3. Change the OlapPartitionPeriods view so that it contains the correct MDX members for your date dimension. You can also add your own partitioning schemes if you need something special.
  4. Change your OLAP cube project to have template partitions with the where clause set to WHERE 1=0
  5. Finally you may need to change the OlapPartitions view if you have some special requirements for the way the PartitionWhereClause is generated
That is it! About one hour of work.

Note, there is no need to change the C# code. The OlapPartitionManager simply works, with no problems.

Listed below are more notes on precise configuration details. However, if you are a good SQL dev, I suggest you just try doing the deploy. The following covers everything in detail just in case you are struggling to get to grips with T-SQL or some finer points of the configuration.

The OlapPartitionManager.exe.Config file

This only contains three configurable elements
  1. The connection string to the SQL Server database in which all the OlapPartitionManager database objects reside
  2. The OlapServerType which identifies the type of server we should connect to (i.e. DEV, UAT or PROD).
  3. The level of logging which should be performed and to where the logging information should be written
  4. The SQL string used to query the OlapServer table. This allows you to change the schema if required.
  5. The SQL string used to query the OlapPartitions view. This allows you to change the schema if required.
By default, the OlapPartitionManageris set up for two logging outputs: logging to the console and to a text file. Optionally you can switch on a rolling log file one where new log files are started when the current log file gets to a certain size. You can also log to a SQL Server table, either using an INSERT statement or by calling a stored procedure. This is clearly commented in the config file and sample logging tables and stored procedures are provided in the source code.

The huge list of other logging options and how to configure each of them is beyond the realms of this page. Full documentation of the configuration options can be found on the Apache log4net™ web site: Apache log4net™ Config Examples

OlapDateDimWrapper view

In the sample code, the OlapDateDimWrapper view is configured to work with the DateDim table from the AdventureWorks DW database (shown below). You simply need to change this view to work with your own date dimension table or equivalent. What you must ensure is that the datatypes and column names remain the same. That is it!
OlapDateDimWrapper.png

OlapPartitionPeriods View

The two columns you need to change in this view are the PartitionSliceMember and PartitionSliceKey. These should be adjusted to match the date dimension in your cube definition. For example, in the sample code which works against the AdventureWorks cube, the PartitionSliceMember has been set as follows:
  • [Date].[Calendar].[Calendar Year] for yearly partitions
  • [Date].[Calendar].[Calendar Quarter] for quarterly partitions
  • [Date].[Calendar].[Month] for monthly partitions
  • [Date].[Calendar Weeks].[Calendar Week] for weekly partitions, and
  • [Date].[Date] for daily partitions
Similarly in the sample code which works against the AdventureWorks cube, the PartitionSliceKey has been set as follows:
  • N'&[' + CalendarYear + N'] for yearly partitions
  • N'&[' + CalendarYear + N']&[' + CalendarQuarter + N']' for quarterly partitions
  • N'&[' + CalendarYear + N']&[' + CalendarMonth + N']' for monthly partitions
  • N'&[' + WeekNumberOfYear + N']&[' + CalendarYear + N']' for weekly partitions, and
  • N'&[' + cast(D.DateKey as nvarchar(8)) + N']' for daily partitions
Note that this view obtains start and end dates for the partition using window functions introduced in SQL Server 2012. If you are still in the dark ages of using SQL Server 2008 or earlier, you will need to adjust this view to replace the min/max window functions.

Below is a screenshot of the OlapPartitionPeriods view configured to work with the AdventureWorks cube.
OlapPartitionPeriods.png

Adding template partitions to your cube project

For every measure group you wish to have partitioned, simply add a partition containing the word template anywhere in its name and adjust its where clause set to be WHERE 1=0. That is it!

The screenshot below shows the template for the Customer Orders partition in the AdventureWorks cube.
TemplatePartition.png

The template partition can have an associated aggregation design which will be assigned to any new partitions based on this template.

You can leave other partitions in place for development purposes (i.e. for quick deploys of your project for dev testing) as these will be deleted by the OlapPartitionManager if the name does not match the partition naming convention.

Implementing a hybrid partitioning scheme

A hybrid partitioning scheme is where some time periods use one scheme and other time periods use another. For example, previous years could be partitioned by quarter whereas the current year is partitioned by day. Another example would be where the current month is partitioned by day, the previous months of the current year partitioned by month and previous year by quarter (or year).

To implement such a scheme, simply edit the OlapPartitionPeriods view and take a look at how I have implemented the hybrid scheme (PartitionPeriod='H') for the AdventureWorks cube. You can implement your own hybrid partitioning scheme by extending this methodology.

Changing the OlapPartitions View

For most partitioning schemes, you will have no need to change the OlapPartitions view. However, if you are implementing an advance matrix partitioning scheme or using an unsupported data type in the WHERE clause, you may need to edit this view. The screenshot below shows the standard results from the OlapPartitions view. Note how the view creates the relevant PartitionWhereClause for each partition.
OlapPartitions.png

Last edited May 20, 2015 at 2:33 PM by JohnTunnicliffe, version 14