Ask AI

PowerBI (dagster-powerbi)

Dagster allows you to represent your PowerBI Workspaces as assets, alongside other your other technologies like dbt and Sling. This allows you to see how your PowerBI assets are connected to your other data assets, and how changes to other data assets might impact your PowerBI Workspaces.

PowerBI API

Here, we provide interfaces to manage PowerBI Workspaces using the PowerBI API.

Assets (PowerBI)

class dagster_powerbi.PowerBIServicePrincipal(*, client_id, client_secret, tenant_id)[source]

Authenticates with PowerBI using a service principal.

class dagster_powerbi.PowerBIToken(*, api_token)[source]

Authenticates with PowerBI directly using an API access token.

class dagster_powerbi.PowerBIWorkspace(*, credentials, workspace_id, refresh_poll_interval=5, refresh_timeout=300)[source]

Represents a workspace in PowerBI and provides utilities to interact with the PowerBI API.

build_defs(dagster_powerbi_translator=<class 'dagster_powerbi.translator.DagsterPowerBITranslator'>, enable_refresh_semantic_models=False)[source]

deprecated This API will be removed in version 1.9.0.

Use dagster_powerbi.load_powerbi_asset_specs instead.

Returns a Definitions object which will load Power BI content from the workspace and translate it into assets, using the provided translator.

Parameters:
  • context (Optional[DefinitionsLoadContext]) – The context to use when loading the definitions. If not provided, retrieved contextually.

  • dagster_powerbi_translator (Type[DagsterPowerBITranslator]) – The translator to use to convert Power BI content into AssetSpecs. Defaults to DagsterPowerBITranslator.

  • enable_refresh_semantic_models (bool) – Whether to enable refreshing semantic models by materializing them in Dagster.

Returns:

A Definitions object which will build and return the Power BI content.

Return type:

Definitions

poll_refresh(dataset_id)[source]

Polls the refresh status of a PowerBI dataset until it completes or fails.

trigger_and_poll_refresh(dataset_id)[source]

Triggers a refresh of a PowerBI dataset and polls until it completes or fails.

trigger_refresh(dataset_id)[source]

Triggers a refresh of a PowerBI dataset.

class dagster_powerbi.DagsterPowerBITranslator(context)[source]

Translator class which converts raw response data from the PowerBI API into AssetSpecs. Subclass this class to implement custom logic for each type of PowerBI content.

dagster_powerbi.load_powerbi_asset_specs(workspace, dagster_powerbi_translator=<class 'dagster_powerbi.translator.DagsterPowerBITranslator'>, use_workspace_scan=True)[source]

experimental This API may break in future versions, even between dot releases.

Returns a list of AssetSpecs representing the Power BI content in the workspace.

Parameters:
  • workspace (PowerBIWorkspace) – The Power BI workspace to load assets from.

  • use_workspace_scan (bool) – Whether to scan the entire workspace using admin APIs at once to get all content. Defaults to True.

Returns:

The set of assets representing the Power BI content in the workspace.

Return type:

List[AssetSpec]

dagster_powerbi.build_semantic_model_refresh_asset_definition(resource_key, spec)[source]

experimental This API may break in future versions, even between dot releases.

Builds an asset definition for refreshing a PowerBI semantic model.