How to do a RequestRefresh for a specific SSAS partition through Microsoft.AnalysisServices in C#

Viewed 116

I'm familiar with a 'Full' Database Table refresh via the RefreshType.Full refresh type using the Microsoft.AnalysisServices.Tabular namespace:

using var server = new Server();
server.Connect("MyConnectionString");
var db = server.Databases.FindByName("MyDatabaseName");
db.Model.Tables["MyTableName"].RequestRefresh(RefreshType.Full);

Say for example, the MyTableName database table has three partitions (Partition 1, Partition 2, and Partition 3).

If I didn't want to do the full database table refresh, but rather only a single partition within that database table, how would one do this syntactically?

1 Answers

first get the table object

var table = db.Model.Tables["MyTableName"]

the table object has the collection of partitions

var partion = table.Partitions["Partition 2"];

the partition object can be "refreshed" using RequestRefresh method

partition.RequestRefresh(Microsoft.AnalysisServices.Tabular.RefreshType.Full);

The actual process will happen when the SaveChanges method is called on the model

var result = db.Model.SaveChanges();
Related