Reputation: 2653
I have a application written in C# that amongst other things connects to a Azure Analysis Service and moves and alerts tabular cubes, once of the functions I run is a "hotswap" function where I remove a "production cube" and replace it with "Temp Cube"(which is then renamed to a production cube):
Tabular.Database d = ssasServer.Databases.FindByName(cubeDBName);
Tabular.Database dnew = ssasServer.Databases.FindByName(tempDBName);
ssasServer.Databases.Remove(d.ID);
ssasServer.Databases.Remove(dnew.ID);
dnew.Name = cubeDBName;
ssasServer.Databases.Add(d);
d?.Drop();
ssasServer.Databases.Add(dnew);
dnew.Update();
Works great :) assuming I prior to this function created the "dnew" cube in seperate function:
Tabular.Database d = new Tabular.Database()
{
Name = ssasServer.Databases.GetNewName(newDbName),
ID = newDatabaseName + $"_" + DateTime.Now.ToString("ddMMyyyyhhmmss"),
CompatibilityLevel = compatibilityLevel,
//This set to ssasServer.SupportedCompatibilityLevels.Split(',').Where(a => a.ToCharArray().Count() == 4).Select(Int32.Parse).Max() which resolves to 1608
StorageEngineUsed = StorageEngineUsed.TabularMetadata,
};
ssasServer.Databases.Add(d);
d.Update();
However... If I create the cube with the function above, then "reconnect" to the AAS:
Tabular.Server s = new Tabular.Server();
s.Disconnect();
s.Connect(GetTabular(ssasServerName, serviceAccountUserName, serviceAccountPassword));
A strange thing beings to happen.. When the "ssasServer.Database.FindByName" function is called, every "database" that is returned is set to "1600" compatiblity level, this causes the following exception to be thrown:
Tabular databases do not support CompatibilityLevel downgrade. Current CompatibilityLevel: '1608'. Requested CompatibilityLevel: '1600'
This is easy to work around by setting the compatiblity level in the hotswap function to 1608, but my question is "why", why is the "Microsoft.AnalysisServices.Tabular" API's returning 1600 when the "SupportedCompatibilityLevels" lists 1608 AND if you navigate to the server in SSMS and examine the cube it is set to 1608?
Upvotes: 0
Views: 41