Last active
April 26, 2022 01:42
-
-
Save yorek/bf87857e0074fccec28c to your computer and use it in GitHub Desktop.
Powershell script to add and process a new SSAS Tabular partition
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load Assembly | |
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices") >$NULL | |
# Connect to Tabular SSAS | |
$srv = New-Object Microsoft.AnalysisServices.Server | |
$srv.connect("localhost\TABULAR") | |
# Point to a specific Database | |
$db = $srv.Databases.FindByName("DatabaseName"); | |
# Store the Data Source View (*MUST* be Sandbox) | |
$dsv = $db.DataSourceViews.FindByName("Sandbox"); | |
# Select a specific Model | |
$c = $db.Cubes.FindByName("ModelName"); | |
# Select a specific Table | |
$mg = $c.MeasureGroups.FindByName("TableName"); | |
# Add new partition and process it | |
$p = $mg.Partitions.Add("NewPartitionName"); | |
$p.Source = New-Object Microsoft.AnalysisServices.QueryBinding($dsv.DataSourceID, "SELECT * FROM [Table] WHERE [PartitionColumn] = 1234"); | |
$p.StorageMode = 'InMemory' | |
$p.Update('ExpandFull') | |
$p.Process('ProcessFull') | |
$srv.Disconnect() |
Author
yorek
commented
Apr 26, 2022
via email
It's been a long time since I played with SSAS Tabular, but it means the name of the DataSourceView must be "Sandbox" and not something else. Be aware that things may have changed in the meantime and that that script may not work anymore.
Davide
From: zouhourrouissi ***@***.***>
Sent: Wednesday, April 20, 2022 3:58 AM
To: yorek ***@***.***>
Cc: Davide Mauri ***@***.***>; Author ***@***.***>
Subject: Re: yorek/add-new-tabular-partition
@zouhourrouissi commented on this gist.
…________________________________
i would like to know what do you mean by (must be sandboxed) ?
thank you.
-
Reply to this email directly, view it on GitHub<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fbf87857e0074fccec28c%23gistcomment-4138992&data=05%7C01%7CDavide.Mauri%40microsoft.com%7C6569fc1828174cfb906308da22bc99b9%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637860490676386957%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=qkIOSczyInar7BTP2nyrq2tsyCxTM8sBsGFUzSnQsTU%3D&reserved=0>, or unsubscribe<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAT5ZCTUORUND4AEKQU4Y63VF7PKTANCNFSM5T3UWHBQ&data=05%7C01%7CDavide.Mauri%40microsoft.com%7C6569fc1828174cfb906308da22bc99b9%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637860490676386957%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=TS6NQ8fSlCORacK94oNlMJQnRLzfC30qhZQafjuStqw%3D&reserved=0>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment