通过TMSL添加SSAS Tabular列

3

早上好,

目标:我正在尝试为SSAS Tabular模型表添加新列。 长期目标是在需要时通过编程方式进行大批量更改。

我找到的资源: https://learn.microsoft.com/en-us/sql/analysis-services/tabular-models-scripting-language-commands/create-command-tmsl

这个网站提供了我一直在遵循的模板,但似乎不起作用。

我已经尝试过的方法:

{
  "create": {  
    "parentObject": {  
      "database": "TabularModel_1_dev"
      , "table": "TableABC"
    }, 
    "columns": [
        {
        "name":  "New Column"
        , "dataType": "string"
        , "sourceColumn": "Column from SQL Source"
        }
    ]   
  }
}

第一个示例最符合要求,但是会返回以下错误:

"The JSON DDL request failed with the following error: Unrecognized JSON property: columns. Check path 'create.columns', line 7, position 15.."

尝试二:
{
  "create": {  
    "parentObject": {  
      "database": "TabularModel_1_dev"
      , "table": "TableABC"
    }, 
    "table": {
    "name": "Item Details by Branch",
    "columns": [
        {
        "name":  "New Column"
        , "dataType": "string"
        , "sourceColumn": "New Column"
        }
    ]
    }
  }
}

在子列表中添加表格也会返回错误;
"...Cannot execute the Create command: the specified parent object cannot have a child object of type Table.." 

在parentObject中省略表格也是不成功的。
1个回答

3

我知道这篇帖子已经发布了三年,但我也在尝试同样的事情,并在我的探索中偶然发现了这篇文章。最终,我联系了 Microsoft,被告知他们文档中提供的添加列示例是一个“文档错误”。事实上,你不能仅仅添加一列,你必须通过 createOrReplace 提供整个表定义。

使用 TMSL 创建列时出现 SSAS 错误


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接