適用於:
SQL Server 2016 和更新版本 Analysis Services
Azure Analysis Services
Fabric/Power BI Premium
表格式模型腳本語言 (TMSL) 是相容性層級 1200 或更高層級表格式數據模型的命令和物件模型定義語法。 TMSL 會透過 XMLA 通訊協定與 Analysis Services 通訊,其中方法 XMLA.Execute 會接受 TMSL 中的 JSON 型 陳述式 腳本,以及 Analysis Services 腳本語言 (適用於 XMLA 的 ASSL) 中的傳統 XML 型腳本。
TMSL 的主要元素:
以表格式模型語意為基礎的表格式元數據。
表格式模型是由數據表、數據行和關聯性所組成。 TMSL 中的對等物件定義現在並不奇怪,數據表、數據行、關聯性等等。 新的元數據引擎支援這些定義。
物件定義會結構化為 JSON,而不是 XML。
除了如何格式化承載(在 JSON 或 XML 中),TMSL 和 ASSL 在功能上都相當於它們如何提供命令和元數據給用於伺服器通訊和數據傳輸的 XMLA 方法。
如何使用TMSL
探索TMSL腳本的最簡單方式是在您已知道的模型上使用SQL Server Management Studio (SSMS) 中的 CREATE、ALTER、DELETE 或 Process 命令。
請找到您要使用的指令:TMSL 參考文件 - 指令
檢查命令中使用的物件的物件定義參考: TMSL 參考 - 物件
選擇執行 TMSL 文稿的方法:
模型定義架構
下列片段顯示相容層級 1200 及以上資料庫的結構定義縮略版本,已摺疊以顯示主要物件。
"database": {
"description": "Database object of Tabular Object Model (TOM)",
"type": "object",
"properties": {
"name": {...},
"id": {...},
"description": {...},
"compatibilityLevel": {...},
"readWriteMode": {...},
"model": {
"description": "Model object of Tabular Object Model (TOM)",
"type": "object",
"properties": {
"name": {...},
"description": {...},
"storageLocation": {...},
"defaultMode": {...},
"defaultDataView": {...},
"culture": {...},
"collation": {...},
"annotations": {...},
"tables": {...},
"relationships": {...},
"dataSources": {...},
"perspectives": {...},
"cultures": {...},
"roles": {...},
// "functions": {...}, // For database compatibility level 1702 and above
},
"additionalProperties": false
}
},
"additionalProperties": false
}
Analysis Services 中的腳本語言
Analysis Services 支援 ASSL 和TMSL腳本語言。 只有以 JSON 格式的TMS描述 1200 相容性層級或更高層級建立的表格式模型。
Analysis Services 腳本語言 (ASSL for XMLA) 是第一個腳本語言,而且仍然是低相容性層級的多維度模型和表格式模型的唯一腳本語言(1100 或 1103)。 在 ASSL 中,110x 的表格式模型會以多維度術語描述,例如 Cube (適用於模型) 和 量值群組 (適用於資料表)。
注意
在 [SQL Server Data Tools (SSDT) 中,您可以將舊版表格式模型的 CompatibilityLevel 切換至 1200 或更高,以使用 TMSL。 請記住,升級無法復原。 在升級之前,請備份您的模型,以防稍後需要原始版本。
下表是特定相容性層級上不同平臺/版本之 Analysis Services 數據模型的腳本語言矩陣。
| 版本 | 多面的 | 表格式 110x | 表格式 1200 | 表格式 1400 | 表格式 1500 | 表格式 1600 |
|---|---|---|---|---|---|---|
| Power BI Premium | 那 | 那 | 那 | 那 | TMSL | TMSL |
| Azure Analysis Services | 那 | 那 | TMSL | TMSL | TMSL | TMSL |
| SQL Server 2022 Analysis Services | ASSL | ASSL | TMSL | TMSL | TMSL | TMSL |
| SQL Server 2019 Analysis Services | ASSL | ASSL | TMSL | TMSL | TMSL | 那 |
| SQL Server 2017 Analysis Services | ASSL | ASSL | TMSL | TMSL | 那 | 那 |
| SQL Server 2016 Analysis Services | ASSL | ASSL | TMSL | 那 | 那 | 那 |
| SQL Server 2014 Analysis Services | ASSL | ASSL | 那 | 那 | 那 | 那 |
| SQL Server 2012 Analysis Services | ASSL | ASSL | 那 | 那 | 那 | 那 |