SSAS: Updating Partitions


I created an F# version, below. Note that my complete code updates the Slice property as well, but my code is too specific the the database to include here.:

let main argv = 
    let adoConnStr = "Data Source={serverName};Catalog={DatabaseName}"
    let amo = new Microsoft.AnalysisServices.Server()
    let asdb = amo.Databases.FindByName("{DatabaseName}")
    let cube = asdb.Cubes.FindByName("{CubeName}")
    let mg = cube.MeasureGroups.FindByName("{MeasureGroupName}")
    let partitions = mg.Partitions
    //// this defines the partitions as a table in BIPOC, used by the view:
    //let parts = getPartitions psql

    let showpartitions = [ for p in partitions do yield ( ( p.Source :?> QueryBinding ).QueryDefinition  ) ]

    for pno in 0..(partitions.Count - 1) do 
        let p = partitions.[pno]
        let qb = p.Source :?> QueryBinding
        let newsql = sprintf "SELECT * FROM BIPOC.dbo.DRWFactPartition(%d) -- Updated:%s" (pno+1) (DateTime.Now.ToString())
        qb.QueryDefinition <- newsql
        // partitions.[pno].Slice <- parts.[pno].slice
        // if p.State = AnalysisState.Unprocessed then p.Process()

    0 // return an integer exit code

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s