使用REST或JSON(来自Linux)查询powerbi站点



我需要从非MS系统(Linux(查询远程PowerBI服务器。

我发现查询可以通过JSON发送,但我很难理解其格式。例如,在给定WHERE和LIKE条件的情况下,如何检索所有表列的内容?

这就是我想到的(不起作用(:

{
"queries" : [
{
"ApplicationContext" : {
"Sources" : [
{
"ReportId" : "ZZZ"
}
],
"DatasetId" : "YYY"
},
"Query" : {
"Commands" : [
{
"SemanticQueryDataShapeCommand" : {
"Query" : {
"Where" : [
{
"Condition" : {
"In" : {
"Values" : [
[
{
"Like" : {
"Value" : "'%abc%'"
}
}
],
null
],
"Expressions" : [
{
"Column" : {
"Property" : "APROPERTY",
"Expression" : {
"SourceRef" : {
"Source" : "A"
}
}
}
}
]
}
}
}
],
"Select" : [
{
"Name" : "AVIEW.APROPERTY",
"Column" : {
"Expression" : {
"SourceRef" : {
"Source" : "A"
}
},
"Property" : "APROPERTY"
}
}
],
"Version" : "2",
"From" : [
{
"Name" : "A",
"Entity" : "AVIEW"
}
]
},
"Binding" : {
"Primary" : {
"Groupings" : [
{
"Projections" : [
"0",
"1"
]
}
]
},
"Version" : "1",
"DataReduction" : {
"DataVolume" : "3",
"Primary" : {
"Top" : {}
}
}
}
}
}
]
},
"QueryId" : ""
}
],
"cancelQueries" : [],
"modelId" : "XXX",
"version" : "1.0.0"
}

这是等效的YAML——也许它更可读:

---
cancelQueries: []
modelId: XXX
queries:
- ApplicationContext:
DatasetId: YYY
Sources:
- ReportId: ZZZ
Query:
Commands:
- SemanticQueryDataShapeCommand:
Binding:
DataReduction:
DataVolume: 3
Primary:
Top: {}
Primary:
Groupings:
- Projections:
- 0
- 1
Version: 1
Query:
From:
- Entity: AVIEW
Name: A
Select:
- Column:
Expression:
SourceRef:
Source: A
Property: APROPERTY
Name: AVIEW.APROPERTY
Version: 2
Where:
- Condition:
In:
Expressions:
- Column:
Expression:
SourceRef:
Source: A
Property: APROPERTY
Values:
-
- Like:
Value: "'%abc%'"
-
QueryId: ''
version: 1.0.0

然后,我使用curl将带有适当标头的上述JSON数据POST到公共url(不需要凭据(,这类似于<URL>/public/reports/querydata。这种查询方法通常有效,我成功地进行了原始查询。但现在我想创建更复杂的查询,因为大多数文档都不讨论这种查询语言,但它要么是基于GUI的,要么是需要安装专有软件的命令行和DAX功能。

我需要的是上面JSON的一些帮助和/或关于上面查询语言的文档的一些指针,我似乎找不到,谢谢。

我自己一直在对一些PowerBI查询进行逆向工程。。。在查询结构本身上没有确切的答案,但";R〃;结果中的数据是一个比特字段,它是某种压缩特征。它指示所描述的字段中的哪些字段在结果"0"中丢失;C";大堆

我的方法,可能是正确的,也可能不是正确的,是首先在";C";数组中给定的位字段值,则有时可以填写";缺少";使用前一行的"中的相同索引字段的字段;C";数组(通常当缺少的字符串值与前一行的值重复时(,并将缺少的数值留空。

最新更新