Skip to content

Commit

Permalink
[6/n][dagster-powerbi] publish dagster-powerbi, add apidoc
Browse files Browse the repository at this point in the history
  • Loading branch information
benpankow committed Aug 7, 2024
1 parent afa86ae commit 4ea19c8
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 9 deletions.
10 changes: 10 additions & 0 deletions docs/content/_apidocs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,16 @@ Dagster also provides a growing set of optional add-on libraries to integrate wi
Includes implementations of run and event log storage built on Postgres.
</td>
</tr>
<tr>
<td>
<a href="/_apidocs/libraries/dagster-powerbi">Power BI</a> (
<code>dagster-powerbi</code>)
</td>
<td>
Provides an integration to represent a Power BI workspace as a graph of
assets.
</td>
</tr>
<tr>
<td>
<a href="/_apidocs/libraries/dagster-prometheus">Prometheus</a> (
Expand Down
4 changes: 4 additions & 0 deletions docs/content/_navigation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1501,6 +1501,10 @@
"title": "PostgreSQL (dagster-postgres)",
"path": "/_apidocs/libraries/dagster-postgres"
},
{
"title": "Power BI (dagster-powerbi)",
"path": "/_apidocs/libraries/dagster-powerbi"
},
{
"title": "Prometheus (dagster-prometheus)",
"path": "/_apidocs/libraries/dagster-prometheus"
Expand Down
Binary file modified docs/content/api/modules.json.gz
Binary file not shown.
Binary file modified docs/content/api/searchindex.json.gz
Binary file not shown.
Binary file modified docs/content/api/sections.json.gz
Binary file not shown.
Binary file modified docs/next/public/objects.inv
Binary file not shown.
1 change: 1 addition & 0 deletions docs/sphinx/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"../../python_modules/libraries/dagster-github",
"../../python_modules/libraries/dagster-k8s",
"../../python_modules/libraries/dagster-looker",
"../../python_modules/libraries/dagster-powerbi",
"../../python_modules/libraries/dagster-managed-elements",
"../../python_modules/libraries/dagster-mlflow",
"../../python_modules/libraries/dagster-msteams",
Expand Down
1 change: 1 addition & 0 deletions docs/sphinx/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
sections/api/apidocs/libraries/dagster-pipes
sections/api/apidocs/libraries/dagster-polars
sections/api/apidocs/libraries/dagster-postgres
sections/api/apidocs/libraries/dagster-powerbi
sections/api/apidocs/libraries/dagster-prometheus
sections/api/apidocs/libraries/dagster-pyspark
sections/api/apidocs/libraries/dagster-shell
Expand Down
17 changes: 17 additions & 0 deletions docs/sphinx/sections/api/apidocs/libraries/dagster-powerbi.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
##########################
Power BI (dagster-powerbi)
##########################

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

.. currentmodule:: dagster_powerbi


Assets
======

.. autoclass:: DagsterPowerBITranslator

.. autoclass:: PowerBIWorkspace
1 change: 1 addition & 0 deletions docs/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ deps =
-e ../python_modules/libraries/dagster-deltalake-polars
-e ../python_modules/libraries/dagster-openai
-e ../python_modules/libraries/dagster-looker
-e ../python_modules/libraries/dagster-powerbi

commands =
make --directory=sphinx clean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

from .resource import PowerBIWorkspace as PowerBIWorkspace
from .translator import DagsterPowerBITranslator as DagsterPowerBITranslator

# Move back to version.py and edit setup.py once we are ready to publish.
__version__ = "1!0+dev"
from .version import __version__

DagsterLibraryRegistry.register("dagster-powerbi", __version__)
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import requests
from dagster import ConfigurableResource
from dagster._annotations import public
from dagster._core.definitions.asset_spec import AssetSpec
from dagster._core.definitions.cacheable_assets import extract_from_current_repository_load_data
from dagster._utils.cached_method import cached_method
Expand All @@ -18,6 +19,7 @@
BASE_API_URL = "https://api.powerbi.com/v1.0/myorg/"


@public
class PowerBIWorkspace(ConfigurableResource):
"""Represents a workspace in PowerBI and provides utilities
to interact with the PowerBI API.
Expand Down Expand Up @@ -119,6 +121,7 @@ def fetch_powerbi_workspace_data(
dashboards + reports + semantic_models + list(data_sources_by_id.values()),
)

@public
def build_asset_specs(
self,
dagster_powerbi_translator: Type[DagsterPowerBITranslator] = DagsterPowerBITranslator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import Any, Dict, Generic, Mapping, Sequence

from dagster import _check as check
from dagster._annotations import public
from dagster._core.definitions.asset_key import AssetKey
from dagster._core.definitions.asset_spec import AssetSpec
from dagster._core.definitions.cacheable_assets import (
Expand Down Expand Up @@ -115,6 +116,7 @@ def from_content_data(
)


@public
class DagsterPowerBITranslator(DagsterTranslator[PowerBIContentData, PowerBIWorkspaceData]):
"""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.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "1!0+dev"
13 changes: 7 additions & 6 deletions python_modules/libraries/dagster-powerbi/setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from pathlib import Path
from typing import Dict

from setuptools import find_packages, setup


def get_version() -> str:
return "1!0+dev"
# Uncomment when ready to publish
# version: Dict[str, str] = {}
# with open(Path(__file__).parent / "dagster_powerbi/version.py", encoding="utf8") as fp:
# exec(fp.read(), version)
version: Dict[str, str] = {}
with open(Path(__file__).parent / "dagster_powerbi/version.py", encoding="utf8") as fp:
exec(fp.read(), version)

# return version["__version__"]
return version["__version__"]


ver = get_version()
Expand Down

0 comments on commit 4ea19c8

Please sign in to comment.