.drop 數據表範圍標籤

從數據表的所有或特定範圍卸除特定 範圍標記 。 此命令會在特定資料庫的內容中執行。

注意

數據分區稱為 範圍,而所有命令都會使用「範圍」或「範圍」做為同義字。 如需範圍的詳細資訊,請參閱範圍 (資料分區) 概觀

有兩種方式可以指定應該要從哪些範圍中移除哪些標記:

  • 明確指定應該從指定資料表中所有範圍移除的標記。
  • 提供一個查詢,其結果會指定資料表中的範圍識別碼,而針對每個範圍指定應移除的標記。

權限

您必須至少擁有所有相關來源和目的地數據表的資料表 管理員 許可權。

Syntax

.drop [async] tableTableNameextenttags(卷標 [, ...])with(extentCreatedOnFrom=FromDate,extentCreatedOnTo=ToDate)

.drop[async] tableTableNameextentwithextentCreatedOnFromtags(=fromDate=,extentCreatedOnTotodateQuery)<|

深入瞭解 語法慣例

參數

名稱 類型 必要 Description
async string 如果指定,作業會以異步方式執行。
TableName string ✔️ 要卸除範圍標籤的數據表名稱。
標籤 string ✔️ 要卸除的範圍標籤名稱。
FromDate datetime 開始日期範圍。
ToDate datetime 結束日期範圍。
查詢 string ✔️ Kusto 查詢語言 (KQL) 查詢,會傳回要卸除的範圍標籤。 請參閱 使用查詢指定範圍

注意

為了提升效能,請將 和 extentCreatedOnTo 參數設定extentCreatedOnFrom為最小的可能範圍。

限制

所有分區都必須在內容資料庫中,而且必須屬於相同的資料表。

傳回

傳回作業標識碼 (GUID) 。

提示

使用查詢來指定範圍

範圍和要卸除的標記是使用 Kusto 查詢指定的。 它會傳回記錄集,其中包含名為 「ExtentId」 的資料行,以及名為 「Tags」 的資料行。

注意

使用 Kusto .NET 用戶端程式庫時,下列方法會產生必要的命令:

  • CslCommandGenerator.GenerateExtentTagsDropByRegexCommand(string tableName, string regex)
  • CslCommandGenerator.GenerateExtentTagsDropBySubstringCommand(string tableName, string substring)

傳回輸出

輸出參數 類型 描述
OriginalExtentId string 原始分區 (其標記已經過修改) 的唯一識別碼 (GUID)。 此分區會在作業過程中卸除。
ResultExtentId string 結果分區 (具有已經過修改的標記) 的唯一識別碼 (GUID)。 會建立分區,並新增為作業的一部分。 失敗時 - "Failed" (失敗)。
ResultExtentTags string 已標記結果範圍的標記集合 (如果有的話);如果作業失敗,則為 "null"。
詳細資料 string 如果作業失敗,則包含失敗詳細資料。

範例

卸除一個標記

從已使用 drop-by:Partition000 標記進行標記的資料表中任何範圍,將其卸除:

.drop extent tags from table MyOtherTable ('drop-by:Partition000')

卸除數個標記

drop-by:20230312104500數據表中標記的任何範圍卸除標記 、 a random tag、 和 drop-by:20230312 ,其中任一個標籤:

.drop table [My Table] extent tags ('drop-by:20230312104500','a random tag','drop-by:20230312') with (extentCreatedOnFrom=datetime(2023-03-10), extentCreatedOnTo=datetime(2023-03-12))

卸除指定建立時間範圍內的所有 drop-by 標記

從資料表MyTable中指定建立時間範圍內的範圍卸除所有drop-by標籤:

.drop table MyTable extent tags with (extentCreatedOnFrom=datetime(2023-03-10), extentCreatedOnTo=datetime(2023-03-12)) <| 
  .show table MyTable extents 
  | where isnotempty(Tags)
  | extend Tags = split(Tags, '\r\n') 
  | mv-expand Tags to typeof(string)
  | where Tags startswith 'drop-by'

卸除符合特定 RegEx 的所有標記

從資料表 MyTable 的範圍中,卸除符合 RegEx drop-by:StreamCreationTime_20160915(\d{6}) 的所有標記:

.drop table MyTable extent tags with (extentCreatedOnFrom=datetime(2023-03-10), extentCreatedOnTo=datetime(2023-03-12)) <| 
  .show table MyTable extents 
  | where isnotempty(Tags)
  | extend Tags = split(Tags, '\r\n')
  | mv-expand Tags to typeof(string)
  | where Tags matches regex @"drop-by:StreamCreationTime_20160915(\d{6})"

範例輸出

OriginalExtentId ResultExtentId ResultExtentTags 詳細資料
e133f050-a1e2-4dad-8552-1f5cf47cab69 0d96ab2d-9dd2-4d2c-a45e-b24c65aa6687 Partition001
cdbeb35b-87ea-499f-b545-defbae091b57 a90a303c-8a14-4207-8f35-d8ea94ca45be
4fcb4598-9a31-4614-903c-0c67c286da8c 97aafea1-59ff-4312-b06b-08f42187872f Partition001 Partition002
2dfdef64-62a3-4950-a130-96b5b1083b5a 0fb7f3da-5e28-4f09-a000-e62eb41592df