Skip to content

Commit 64b0e3e

Browse files
idear1203Dongwei Wang
andauthored
[Synapse] - revert sqlv3 public preview change (#15453)
* Update change log * [Synapse] - Revert recent changes for SQL pool v3 * Update changelog * Update breaking change exceptions Co-authored-by: Dongwei Wang <[email protected]>
1 parent 05a2fbd commit 64b0e3e

File tree

18 files changed

+1950
-3416
lines changed

18 files changed

+1950
-3416
lines changed

src/Synapse/Synapse.Test/ScenarioTests/SqlPoolV3Tests.ps1

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,6 @@ function Test-SynapseSqlPoolV3
8383
}
8484
Assert-True {$found -eq 1} "SqlPool created earlier is not found when listing all in resource group: $resourceGroupName."
8585

86-
# Suspend SqlPool
87-
$sqlPoolSuspended = Suspend-AzSynapseSqlPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sqlPoolName -Version 3
88-
89-
Assert-AreEqual "Paused" $sqlPoolSuspended.Status
90-
91-
# Resume SqlPool
92-
$sqlPoolResumed = Resume-AzSynapseSqlPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sqlPoolName -Version 3
93-
94-
Assert-AreEqual "Online" $sqlPoolResumed.Status
95-
9686
# Delete SqlPool
9787
Assert-True {Remove-AzSynapseSqlPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sqlPoolName -Version 3 -PassThru -Force} "Remove SqlPool failed."
9888

src/Synapse/Synapse.Test/SessionRecords/Microsoft.Azure.Commands.Synapse.Test.ScenarioTests.SqlDatabaseTests/TestSynapseSqlDatabase.json

Lines changed: 1036 additions & 478 deletions
Large diffs are not rendered by default.

src/Synapse/Synapse.Test/SessionRecords/Microsoft.Azure.Commands.Synapse.Test.ScenarioTests.SqlPoolV3Tests/TestSynapseSqlPoolV3.json

Lines changed: 832 additions & 2566 deletions
Large diffs are not rendered by default.

src/Synapse/Synapse/ChangeLog.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,6 @@
1919
-->
2020
## Upcoming Release
2121
* Added parameter `-ManagedResourceGroupName` for the `New-AzSynapseWorkspace` cmdlet
22-
* `New-AzSynapseSqlDatabase` now supports storage redundancy
23-
- Removed parameter `-MaxSizeInBytes`. It is no longer supported any more.
24-
- Added parameter `-StorageRedundancy`. Possible values: Geo, GeoZone, Local, Zone
25-
* `New-AzSynapseSqlPool` now supports autoScale and autoPause
26-
- Added parameters `-MaxServiceObjectName -AutoPauseTimer -EnableAutoResume`
27-
* `Resume-AzSynapseSqlPool`, `Suspend-AzSynapseSqlPool` now supports SQL pool Gen3
28-
- Added parameter `-Version`
29-
* `Update-AzSynapseSqlPool` now supports autoScale and autoPause
30-
- Added parameters `-MaxServiceObjectName -AutoPauseTimer -AutoResume`
3122

3223
## Version 0.13.0
3324
* Add support for Synapse Spark job definition

src/Synapse/Synapse/Commands/ManagementCommands/SqlDatabase/NewAzureSynapseSqlDatabase.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ public class NewAzureSynapseSqlDatabase : SynapseManagementCmdletBase
5151
[ValidateNotNullOrEmpty]
5252
public string Collation { get; set; }
5353

54-
[Parameter(Mandatory = false, HelpMessage = HelpMessages.StorageRedundancy)]
55-
public PSSqlDatabaseStorageRedundancyType StorageRedundancy { get; set; }
56-
5754
[Parameter(Mandatory = false, HelpMessage = HelpMessages.AsJob)]
5855
public SwitchParameter AsJob { get; set; }
5956

@@ -93,7 +90,6 @@ public override void ExecuteCmdlet()
9390
case CreateByNameParameterSet:
9491
case CreateByParentObjectParameterSet:
9592
createParams.Collation = this.IsParameterBound(c => c.Collation) ? this.Collation : SynapseConstants.DefaultCollation;
96-
createParams.StorageRedundancy = this.IsParameterBound(c => c.StorageRedundancy) ? this.StorageRedundancy.ToString() : null;
9793
break;
9894

9995
default: throw new AzPSInvalidOperationException(string.Format(Resources.InvalidParameterSet, this.ParameterSetName));

src/Synapse/Synapse/Commands/ManagementCommands/SqlDatabase/UpdateAzureSynapseSqlDatabase.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@ public class UpdateAzureSynapseSqlDatabase : SynapseManagementCmdletBase
4141
[ValidateNotNullOrEmpty]
4242
public string Name { get; set; }
4343

44-
[Parameter(ParameterSetName = UpdateByNameParameterSet, Mandatory = false, HelpMessage = HelpMessages.MaxSizeInBytes)]
45-
[Parameter(ParameterSetName = UpdateByParentObjectParameterSet, Mandatory = false, HelpMessage = HelpMessages.MaxSizeInBytes)]
46-
[ValidateNotNullOrEmpty]
47-
public long MaxSizeInBytes { get; set; }
48-
4944
[Parameter(ValueFromPipeline = true, ParameterSetName = UpdateByParentObjectParameterSet,
5045
Mandatory = true, HelpMessage = HelpMessages.WorkspaceObject)]
5146
[ValidateNotNull]

src/Synapse/Synapse/Commands/ManagementCommands/SqlPool/GetAzureSynapseSqlPool.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ public class GetAzureSynapseSqlPool : SynapseManagementCmdletBase
4040
public string Name { get; set; }
4141

4242
[Parameter(Mandatory = false, HelpMessage = HelpMessages.SqlPoolVersion)]
43-
[ValidateRange(2, 3)]
4443
[ValidateNotNullOrEmpty]
44+
[ValidateRange(2, 3)]
4545
public int Version { get; set; }
4646

4747
[Parameter(Mandatory = true, ValueFromPipeline = true, ParameterSetName = GetByParentObjectParameterSet, HelpMessage = HelpMessages.WorkspaceObject)]

src/Synapse/Synapse/Commands/ManagementCommands/SqlPool/NewAzureSynapseSqlPool.cs

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,6 @@ public class NewAzureSynapseSqlPool : SynapseManagementCmdletBase
6363
[ValidateNotNullOrEmpty]
6464
public string Collation { get; set; }
6565

66-
[Parameter(Mandatory = false, HelpMessage = HelpMessages.MaxServiceObjectName)]
67-
[ValidateNotNullOrEmpty]
68-
public string MaxServiceObjectName { get; set; }
69-
70-
[Parameter(Mandatory = false, HelpMessage = HelpMessages.AutoPauseTimer)]
71-
public int AutoPauseTimer { get; set; }
72-
73-
[Parameter(Mandatory = false, HelpMessage = HelpMessages.AutoResume)]
74-
public SwitchParameter EnableAutoResume { get; set; }
75-
7666
[Parameter(Mandatory = false, HelpMessage = HelpMessages.AsJob)]
7767
public SwitchParameter AsJob { get; set; }
7868

@@ -107,27 +97,19 @@ public override void ExecuteCmdlet()
10797
var createParams = new SqlPoolV3
10898
{
10999
Location = existingWorkspace.Location,
110-
Tags = TagsConversionHelper.CreateTagDictionary(this.Tag, validate: true),
111-
MaxServiceObjectiveName = this.MaxServiceObjectName,
112-
Sku = new SkuV3
113-
{
114-
Name = this.PerformanceLevel
115-
}
100+
Tags = TagsConversionHelper.CreateTagDictionary(this.Tag, validate: true)
116101
};
117102

118-
if (this.IsParameterBound(c => this.MaxServiceObjectName))
119-
{
120-
createParams.MaxServiceObjectiveName = this.MaxServiceObjectName;
121-
}
122-
123-
if (this.IsParameterBound(c => c.AutoPauseTimer))
124-
{
125-
createParams.AutoPauseTimer = this.AutoPauseTimer;
126-
}
127-
128-
if (this.EnableAutoResume.IsPresent)
103+
switch (this.ParameterSetName)
129104
{
130-
createParams.AutoResume = true;
105+
case CreateByNameParameterSet:
106+
case CreateByParentObjectParameterSet:
107+
createParams.Sku = new SkuV3
108+
{
109+
Name = this.PerformanceLevel
110+
};
111+
break;
112+
default: throw new AzPSInvalidOperationException(string.Format(Resources.InvalidParameterSet, this.ParameterSetName));
131113
}
132114

133115
if (this.ShouldProcess(this.Name, string.Format(Resources.CreatingSynapseSqlPool, this.ResourceGroupName, this.WorkspaceName, this.Name)))

src/Synapse/Synapse/Commands/ManagementCommands/SqlPool/ResumeAzureSynapseSqlPool.cs

Lines changed: 17 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ public class ResumeAzureSynapseSqlPool : SynapseManagementCmdletBase
5555
[ValidateNotNullOrEmpty]
5656
public string ResourceId { get; set; }
5757

58-
[Parameter(Mandatory = false, HelpMessage = HelpMessages.SqlPoolVersion)]
59-
[ValidateRange(2, 3)]
60-
[ValidateNotNullOrEmpty]
61-
public int Version { get; set; }
62-
6358
[Parameter(Mandatory = false, HelpMessage = HelpMessages.PassThru)]
6459
public SwitchParameter PassThru { get; set; }
6560

@@ -97,53 +92,26 @@ public override void ExecuteCmdlet()
9792
this.ResourceGroupName = this.SynapseAnalyticsClient.GetResourceGroupByWorkspaceName(this.WorkspaceName);
9893
}
9994

100-
if (this.Version == 3)
95+
SqlPool existingSqlPool = null;
96+
try
97+
{
98+
existingSqlPool = this.SynapseAnalyticsClient.GetSqlPool(this.ResourceGroupName, this.WorkspaceName, this.Name);
99+
}
100+
catch
101+
{
102+
existingSqlPool = null;
103+
}
104+
105+
if (existingSqlPool == null)
101106
{
102-
SqlPoolV3 existingSqlPool = null;
103-
try
104-
{
105-
existingSqlPool = this.SynapseAnalyticsClient.GetSqlPoolV3(this.ResourceGroupName, this.WorkspaceName, this.Name);
106-
}
107-
catch
108-
{
109-
existingSqlPool = null;
110-
}
111-
112-
if (existingSqlPool == null)
113-
{
114-
throw new AzPSResourceNotFoundCloudException(string.Format(Resources.FailedToDiscoverSqlPool, this.Name, this.ResourceGroupName, this.WorkspaceName));
115-
}
116-
117-
if (this.ShouldProcess(this.Name, string.Format(Resources.ResumingSynapseSqlPool, this.Name, this.ResourceGroupName, this.WorkspaceName)))
118-
{
119-
this.SynapseAnalyticsClient.ResumeSqlPoolV3(this.ResourceGroupName, this.WorkspaceName, this.Name);
120-
var result = new PSSynapseSqlPoolV3(this.SynapseAnalyticsClient.GetSqlPoolV3(this.ResourceGroupName, this.WorkspaceName, this.Name));
121-
WriteObject(result);
122-
}
107+
throw new AzPSResourceNotFoundCloudException(string.Format(Resources.FailedToDiscoverSqlPool, this.Name, this.ResourceGroupName, this.WorkspaceName));
123108
}
124-
else
109+
110+
if (this.ShouldProcess(this.Name, string.Format(Resources.ResumingSynapseSqlPool, this.Name, this.ResourceGroupName, this.WorkspaceName)))
125111
{
126-
SqlPool existingSqlPool = null;
127-
try
128-
{
129-
existingSqlPool = this.SynapseAnalyticsClient.GetSqlPool(this.ResourceGroupName, this.WorkspaceName, this.Name);
130-
}
131-
catch
132-
{
133-
existingSqlPool = null;
134-
}
135-
136-
if (existingSqlPool == null)
137-
{
138-
throw new AzPSResourceNotFoundCloudException(string.Format(Resources.FailedToDiscoverSqlPool, this.Name, this.ResourceGroupName, this.WorkspaceName));
139-
}
140-
141-
if (this.ShouldProcess(this.Name, string.Format(Resources.ResumingSynapseSqlPool, this.Name, this.ResourceGroupName, this.WorkspaceName)))
142-
{
143-
this.SynapseAnalyticsClient.ResumeSqlPool(this.ResourceGroupName, this.WorkspaceName, this.Name);
144-
var result = new PSSynapseSqlPool(this.ResourceGroupName, this.WorkspaceName, this.SynapseAnalyticsClient.GetSqlPool(this.ResourceGroupName, this.WorkspaceName, this.Name));
145-
WriteObject(result);
146-
}
112+
this.SynapseAnalyticsClient.ResumeSqlPool(this.ResourceGroupName, this.WorkspaceName, this.Name);
113+
var result = new PSSynapseSqlPool(this.ResourceGroupName, this.WorkspaceName, this.SynapseAnalyticsClient.GetSqlPool(this.ResourceGroupName, this.WorkspaceName, this.Name));
114+
WriteObject(result);
147115
}
148116
}
149117
}

src/Synapse/Synapse/Commands/ManagementCommands/SqlPool/SuspendAzureSynapseSqlPool.cs

Lines changed: 17 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ public class SuspendAzureSynapseSqlPool : SynapseManagementCmdletBase
5555
[ValidateNotNullOrEmpty]
5656
public string ResourceId { get; set; }
5757

58-
[Parameter(Mandatory = false, HelpMessage = HelpMessages.SqlPoolVersion)]
59-
[ValidateRange(2, 3)]
60-
[ValidateNotNullOrEmpty]
61-
public int Version { get; set; }
62-
6358
[Parameter(Mandatory = false, HelpMessage = HelpMessages.PassThru)]
6459
public SwitchParameter PassThru { get; set; }
6560

@@ -97,53 +92,26 @@ public override void ExecuteCmdlet()
9792
this.ResourceGroupName = this.SynapseAnalyticsClient.GetResourceGroupByWorkspaceName(this.WorkspaceName);
9893
}
9994

100-
if (this.Version == 3)
95+
SqlPool existingSqlPool = null;
96+
try
97+
{
98+
existingSqlPool = this.SynapseAnalyticsClient.GetSqlPool(this.ResourceGroupName, this.WorkspaceName, this.Name);
99+
}
100+
catch
101+
{
102+
existingSqlPool = null;
103+
}
104+
105+
if (existingSqlPool == null)
101106
{
102-
SqlPoolV3 existingSqlPool = null;
103-
try
104-
{
105-
existingSqlPool = this.SynapseAnalyticsClient.GetSqlPoolV3(this.ResourceGroupName, this.WorkspaceName, this.Name);
106-
}
107-
catch
108-
{
109-
existingSqlPool = null;
110-
}
111-
112-
if (existingSqlPool == null)
113-
{
114-
throw new AzPSResourceNotFoundCloudException(string.Format(Resources.FailedToDiscoverSqlPool, this.Name, this.ResourceGroupName, this.WorkspaceName));
115-
}
116-
117-
if (this.ShouldProcess(this.Name, string.Format(Resources.SuspendingSynapseSqlPool, this.Name, this.ResourceGroupName, this.WorkspaceName)))
118-
{
119-
this.SynapseAnalyticsClient.PauseSqlPoolV3(this.ResourceGroupName, this.WorkspaceName, this.Name);
120-
var result = new PSSynapseSqlPoolV3(this.SynapseAnalyticsClient.GetSqlPoolV3(this.ResourceGroupName, this.WorkspaceName, this.Name));
121-
WriteObject(result);
122-
}
107+
throw new AzPSResourceNotFoundCloudException(string.Format(Resources.FailedToDiscoverSqlPool, this.Name, this.ResourceGroupName, this.WorkspaceName));
123108
}
124-
else
109+
110+
if (this.ShouldProcess(this.Name, string.Format(Resources.SuspendingSynapseSqlPool, this.Name, this.ResourceGroupName, this.WorkspaceName)))
125111
{
126-
SqlPool existingSqlPool = null;
127-
try
128-
{
129-
existingSqlPool = this.SynapseAnalyticsClient.GetSqlPool(this.ResourceGroupName, this.WorkspaceName, this.Name);
130-
}
131-
catch
132-
{
133-
existingSqlPool = null;
134-
}
135-
136-
if (existingSqlPool == null)
137-
{
138-
throw new AzPSResourceNotFoundCloudException(string.Format(Resources.FailedToDiscoverSqlPool, this.Name, this.ResourceGroupName, this.WorkspaceName));
139-
}
140-
141-
if (this.ShouldProcess(this.Name, string.Format(Resources.SuspendingSynapseSqlPool, this.Name, this.ResourceGroupName, this.WorkspaceName)))
142-
{
143-
this.SynapseAnalyticsClient.PauseSqlPool(this.ResourceGroupName, this.WorkspaceName, this.Name);
144-
var result = new PSSynapseSqlPool(this.ResourceGroupName, this.WorkspaceName, this.SynapseAnalyticsClient.GetSqlPool(this.ResourceGroupName, this.WorkspaceName, this.Name));
145-
WriteObject(result);
146-
}
112+
this.SynapseAnalyticsClient.PauseSqlPool(this.ResourceGroupName, this.WorkspaceName, this.Name);
113+
var result = new PSSynapseSqlPool(this.ResourceGroupName, this.WorkspaceName, this.SynapseAnalyticsClient.GetSqlPool(this.ResourceGroupName, this.WorkspaceName, this.Name));
114+
WriteObject(result);
147115
}
148116
}
149117
}

0 commit comments

Comments
 (0)