Skip to content

Commit 0a8c538

Browse files
bashaheewyunchi-ms
andauthored
SQL Data Classification - Update id split logic (#13746)
* Update DataClassificationAdapter.cs * Update DataClassificationAdapter.cs * Update ChangeLog.md * Update DataClassificationAdapter.cs Co-authored-by: Yunchi Wang <[email protected]>
1 parent 851fab3 commit 0a8c538

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/Sql/Sql/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
-->
2020
## Upcoming Release
2121
* Fixed parameter description for `InstanceFailoverGroup` command.
22+
* Updated the logic in which schemaName, tableName and columnName are being extracted from the id of SQL Data Classification commands.
2223
* Fixed Status and StatusMessage fields in `Get-AzSqlDatabaseImportExportStatus` to conform to documentation
2324

2425
## Version 2.13.0

src/Sql/Sql/DataClassification/Services/DataClassificationAdapter.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,12 +285,14 @@ private static SensitivityLabel ToSensitivityLabel(SensitivityLabelModel sensiti
285285

286286
private static SensitivityLabelModel ToSensitivityLabelModel(SensitivityLabel sensitivityLabel)
287287
{
288-
string[] idComponents = sensitivityLabel.Id.Split('/');
288+
var match = new global::System.Text.RegularExpressions.Regex("/schemas/(?<schemaName>.*)/tables/(?<tableName>.*)/columns/(?<columnName>.*)/sensitivityLabels/",
289+
global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(sensitivityLabel.Id);
290+
289291
return new SensitivityLabelModel
290292
{
291-
SchemaName = idComponents[12],
292-
TableName = idComponents[14],
293-
ColumnName = idComponents[16],
293+
SchemaName = match.Groups["schemaName"].Value,
294+
TableName = match.Groups["tableName"].Value,
295+
ColumnName = match.Groups["columnName"].Value,
294296
SensitivityLabel = NullifyStringIfEmpty(sensitivityLabel.LabelName),
295297
SensitivityLabelId = NullifyStringIfEmpty(sensitivityLabel.LabelId),
296298
InformationType = NullifyStringIfEmpty(sensitivityLabel.InformationType),

0 commit comments

Comments
 (0)