SSAS Tabular - How to create Daily Partition on Fact and execute from Stored Procedure
Hello Experts,
We have DWH & Tabular database having numbers of Dim and 2 Fact tables. One of the fact table session_member expect 1 millions of data processing per day.
Earlier we had no Partitions on Fact tables of Datawarehouse and monthly partitions on tabular fact tables. Now have introduced daily partitions on Fact data warehouse table and accordingly would like to create/amend the existing monthly partitions.
The monthly Partitions on tabular table was being created for next 12 monthly manually in advance, since we have to processes daily partitions can anyone please suggest way to do so?
Below is the code of SP being used to process monthly partitions , where the partitions were already created in advance manually.
CREATE PROCEDURE ProcessMonthlyPartition
AS
BEGIN
DECLARE @CurrentMonth NVARCHAR(20)
DECLARE @PartitionName NVARCHAR(100)
DECLARE @JsonCommand NVARCHAR(MAX)
DECLARE @CurrentYear NVARCHAR(4)
DECLARE @DataBaseName NVARCHAR(100) = 'dev-ssas'
DECLARE @TableName NVARCHAR(100) = 'fact_viewing_session_member'
SET @CurrentMonth = DATENAME(MONTH, GETDATE())
SET @CurrentYear = DATEPART(YEAR, GETDATE())
SET @PartitionName = 'Partition_' + @CurrentMonth + '_' + @CurrentYear
SET @JsonCommand = '{
"refresh": {
"type": "automatic",
"objects": [
{
"database": "' + @DataBaseName + '",
"table": "' + @TableName + '",
"partition": "' + @PartitionName + '"
}
]
}
}'
EXEC (@JsonCommand) AT SSASTABULAR; -- linked server name
END