diff --git a/AlmToolkit/BismNormalizer/TabularCompare/ComparisonFactory.cs b/AlmToolkit/BismNormalizer/TabularCompare/ComparisonFactory.cs
index a9b7f28..ff4e1bb 100644
--- a/AlmToolkit/BismNormalizer/TabularCompare/ComparisonFactory.cs
+++ b/AlmToolkit/BismNormalizer/TabularCompare/ComparisonFactory.cs
@@ -183,7 +183,7 @@ namespace BismNormalizer.TabularCompare
)
)
{
- returnTabularComparison.TargetTabularModel.Connect();
+ returnTabularComparison.TargetTabularModel.TomConnect();
returnTabularComparison.TargetTabularModel.TomDatabase.CompatibilityLevel = comparisonInfo.SourceCompatibilityLevel;
returnTabularComparison.TargetTabularModel.TomDatabase.Update();
returnTabularComparison.MetadataResyncRequired = true;
diff --git a/AlmToolkit/BismNormalizer/TabularCompare/TabularMetadata/Comparison.cs b/AlmToolkit/BismNormalizer/TabularCompare/TabularMetadata/Comparison.cs
index c48076a..1e41da0 100644
--- a/AlmToolkit/BismNormalizer/TabularCompare/TabularMetadata/Comparison.cs
+++ b/AlmToolkit/BismNormalizer/TabularCompare/TabularMetadata/Comparison.cs
@@ -1406,18 +1406,27 @@ namespace BismNormalizer.TabularCompare.TabularMetadata
{
if (table.TomTable.RefreshPolicy != null)
{
- //Confirm the table with incremental refresh policy isn't going to be deleted anyway
- bool tableBeingDeletedAnyway = false;
+ //Confirm the table with incremental refresh policy isn't going to be deleted (or updated to not have a refresh policy) anyway
+ bool policyBeingDeletedAnyway = false;
foreach (ComparisonObject comparisonObjectToCheck in _comparisonObjects)
{
if (comparisonObjectToCheck.TargetObjectName == table.Name && comparisonObjectToCheck.MergeAction == MergeAction.Delete)
{
- tableBeingDeletedAnyway = true;
+ policyBeingDeletedAnyway = true;
+ break;
+ }
+
+ if (comparisonObjectToCheck.TargetObjectName == table.Name && comparisonObjectToCheck.MergeAction == MergeAction.Update &&
+ !_comparisonInfo.OptionsInfo.OptionRetainRefreshPolicy && !_comparisonInfo.OptionsInfo.OptionRetainPartitions &&
+ _sourceTabularModel.Tables.ContainsName(table.Name) && _sourceTabularModel.Tables.FindByName(table.Name).TomTable.RefreshPolicy == null)
+ //Condition above includes OptionRetainPartitions because otherwise removal of the policy wouldn't go through if there are partitions in it
+ {
+ policyBeingDeletedAnyway = true;
break;
}
}
- if (!tableBeingDeletedAnyway)
+ if (!policyBeingDeletedAnyway)
{
OnValidationMessage(new ValidationMessageEventArgs($"Unable to delete expression {comparisonObject.TargetObjectName} because it is an incremental-refresh parameter and table {table.Name} contains an incremental-refresh policy.", ValidationMessageType.Expression, ValidationMessageStatus.Warning));
return;
diff --git a/AlmToolkit/BismNormalizer/TabularCompare/TabularMetadata/TabularModel.cs b/AlmToolkit/BismNormalizer/TabularCompare/TabularMetadata/TabularModel.cs
index cc2264d..ae3d8c5 100644
--- a/AlmToolkit/BismNormalizer/TabularCompare/TabularMetadata/TabularModel.cs
+++ b/AlmToolkit/BismNormalizer/TabularCompare/TabularMetadata/TabularModel.cs
@@ -53,32 +53,11 @@ namespace BismNormalizer.TabularCompare.TabularMetadata
}
///
- /// Connect to SSAS server and instantiate properties of the TabularModel object.
+ /// Connect to AS server and instantiate properties of the TabularModel object.
///
public void Connect()
{
- this.Disconnect();
-
- if (_connectionInfo.UseTmdlFolder)
- {
- _database = _connectionInfo.OpenDatabaseFromFolder();
- }
- else if (_connectionInfo.UseBimFile)
- {
- _database = _connectionInfo.OpenDatabaseFromFile();
- }
- else
- {
- _server = new Server();
- _server.Connect(_connectionInfo.BuildConnectionString());
-
- _database = _server.Databases.FindByName(_connectionInfo.DatabaseName);
- if (_database == null)
- {
- //Don't need try to load from project here as will already be done before instantiated Comparison
- throw new Amo.ConnectionException($"Could not connect to database {_connectionInfo.DatabaseName}");
- }
- }
+ TomConnect();
//Shell model
_model = new Model(this, _database.Model);
@@ -165,6 +144,35 @@ namespace BismNormalizer.TabularCompare.TabularMetadata
}
}
+ ///
+ /// Connect only to AS server. Does not instantiate properties of the TabularModel object.
+ ///
+ public void TomConnect()
+ {
+ this.Disconnect();
+
+ if (_connectionInfo.UseTmdlFolder)
+ {
+ _database = _connectionInfo.OpenDatabaseFromFolder();
+ }
+ else if (_connectionInfo.UseBimFile)
+ {
+ _database = _connectionInfo.OpenDatabaseFromFile();
+ }
+ else
+ {
+ _server = new Server();
+ _server.Connect(_connectionInfo.BuildConnectionString());
+
+ _database = _server.Databases.FindByName(_connectionInfo.DatabaseName);
+ if (_database == null)
+ {
+ //Don't need try to load from project here as will already be done before instantiated Comparison
+ throw new Amo.ConnectionException($"Could not connect to database {_connectionInfo.DatabaseName}");
+ }
+ }
+ }
+
private void InitializeCalcDependenciesFromServer()
{
_calcDependencies.Clear();
@@ -710,6 +718,7 @@ namespace BismNormalizer.TabularCompare.TabularMetadata
else
{
tableTarget.TomTable.RefreshPolicy = tomTableTargetOrig.RefreshPolicy.Clone();
+ retainPartitionsMessage = "Retain refresh policy option applied. " + retainPartitionsMessage;
}
}
}