Can't miss session! The 9 FabCon and SQLCon takeaways the community can't stop talking about. Join us on April 2nd. Register now
I ran the following method on datamart just to test if refreshes method is avaialble to datamart apiPath ( as it is availabale to dataset apiPath)
-- the following returns error on datamart
%%sql
WITH cte_workspaces AS (
SELECT explode(pbi_api_udf('/groups', '${pbi_access_token}')) as workspace
)
, cteTwo as (
select workspace.name as workspace_name,workspace.id as workspace_id,workspace.apiPath as workspace_apiPath
from cte_workspaces
WHERE workspace.name = 'Production'
)
, cteThree as (
select *
,dm.apiPath as apiPath
from cteTwo
LATERAL VIEW explode(pbi_api_udf(concat( workspace_apiPath, '/datamarts'), '${pbi_access_token}')) AS dm
)
select *
from cteThree
LATERAL VIEW explode(pbi_api_udf(concat( apiPath, '/refreshes'), '${pbi_access_token}')) AS refreshes
-- the following works perfectly on dataset (semantic model)
%%sql
WITH cte_workspaces AS (
SELECT explode(pbi_api_udf('/groups', '${pbi_access_token}')) as workspace
)
, cteB as (
select
workspace.name as workspace_name
,workspace.id as workspace_id
,workspace.apiPath as workspace_apiPath
,datasets.name as ds_name
,datasets.apiPath as apiPath
from cte_workspaces
LATERAL VIEW explode(pbi_api_udf(concat(workspace.apiPath, '/datasets'), '${pbi_access_token}')) datasetsTable AS datasets
WHERE workspace.name = 'Production'
)
select *
FROM cteB
LATERAL VIEW explode(pbi_api_udf(concat( apiPath, '/refreshes'), '${pbi_access_token}')) AS refreshes
But it returns {"error":"Not Found","status_code":"404"}
How am I to know, what methods are avaialble to the datamart apiPath? Does there exists a documentation that says what methods are available to what artifacts?
thats indeed interesting as this API is not mentioned anywhere 😄
neither in the docs nor in the SDK
https://github.com/microsoft/PowerBI-CSharp/blob/master/sdk/swaggers/swagger.json
I just checked the docs (https://learn.microsoft.com/en-us/rest/api/power-bi/datasets) and it seems there are no APIs for datamarts hence you cannot query them with my code from above
@gbrueckl Thanks.
The documenation does not list any method for datamart
yet the following succeeds on a workspace_apiPath concat('/groups/abcdef-ghij-klmn-opqr-stuvwx',
cteThree as (
select dm
from cteTwo
LATERAL VIEW explode(pbi_api_udf(concat( workspace_apiPath, '/datamarts'), '${pbi_access_token}')) AS dm
)
the above returns an object
{
"capabilities": "4",
"lastRefreshTimeUTC": "2024-05-28T22:47:54.263Z",
"modifiedByUser": "{displayName=user, userPrincipalName=user@company.com, objectId=9e1103aa-a128-4bec-8b8e-d1004422b3b7}",
"name": "DEV",
"state": "1",
"datasetObjectId": "f331fd8e-b3ce-4b24-90aa-c5a0d6699aaf",
"lastRefreshStatus": "1",
"datamartType": "Sql",
"apiPath": "/groups/grpID/datamarts",
"nextRefreshTimeUTC": "9999-12-31T23:59:59.997Z",
"datasetId": "1955466",
"version": "638477205269348724",
"ownerUser": "{displayName=user, userPrincipalName=user@company.com, objectId=9e1103aa-a128-4bec-8b8e-d1004422b3b7}",
"lastModifiedTimeUTC": "2024-05-29T00:58:29.79",
"status": "1",
"objectId": "245952d6-0487-4f2a-abcb-89689d4813c5",
"folderObjectId": "f8a6fefa-0df7-4fe7-ac93-dc0a9003594e",
"dataflowObjectId": "659bd422-955c-43b7-8304-4e50b8f1ab48",
"createdDate": "2024-05-28T15:06:43.76"
}
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.