query_semanticmodel¶
Run a DAX query against a semantic model and print the rows it returns in the deploy log. Use it as a read-back after a refresh: how many rows a table holds, which partitions loaded, a measure's value in this environment.
Step fragment for a hooks file. Shared step keys are under Steps.
- name: Count the trips
action: query_semanticmodel
item: <Name>.SemanticModel # `.SemanticModel` may be omitted
query: |
EVALUATE ROW("trips", COUNTROWS(Trip))
on_error: fail # default: stop the deploy here; `continue` logs it and goes on
Keys¶
| Key | Required | Description |
|---|---|---|
item |
yes | The model, <Name> or <Name>.SemanticModel. |
query |
yes | One DAX query, starting with EVALUATE. |
Behaviour¶
The hook sends the query to Power BI's Execute Queries API through fab api -A powerbi, then prints the first table of the answer: a header of the column names Power BI returns, then a line per row. It prints at most 20 rows and says how many more it left out, and cuts a cell longer than 40 characters. A blank prints as nothing.
The step fails only when the query does: a DAX syntax error, a column that does not exist, or Power BI refusing the call. What the query returns never fails it. Add on_error: continue if a failed read-back should not stop the deploy.
Name it under post_deploy_hooks after the refresh_semanticmodel step: a model that has not refreshed holds no data.
Needs¶
- The tenant setting that allows the Execute Queries REST API, turned on by a Fabric admin. [Check the exact setting name on Microsoft's Execute Queries page.]
- Read and Build permission on the model for the deploying identity. The identity that deployed the model owns it after the sample's take-over step.