From a2908f221347a9048ec63a9195d294681cf4474e Mon Sep 17 00:00:00 2001 From: Christian Minich Date: Thu, 31 Oct 2024 14:57:02 -0400 Subject: [PATCH] add link to descriptions --- hooli_data_eng/assets/powerbi_assets.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/hooli_data_eng/assets/powerbi_assets.py b/hooli_data_eng/assets/powerbi_assets.py index 359d0c80..524fe509 100644 --- a/hooli_data_eng/assets/powerbi_assets.py +++ b/hooli_data_eng/assets/powerbi_assets.py @@ -1,4 +1,4 @@ -from dagster import AssetKey, AssetSpec +from dagster import AssetKey, AssetSpec, EnvVar from dagster._core.definitions.asset_spec import replace_attributes from dagster_powerbi import ( load_powerbi_asset_specs, @@ -11,21 +11,35 @@ class MyCustomPowerBITranslator(DagsterPowerBITranslator): def get_report_spec(self, data: PowerBIContentData) -> AssetSpec: - return super().get_report_spec(data)._replace(group_name="BI") + spec = super().get_report_spec(data) + return replace_attributes( + spec, + description=f"Report link: https://app.powerbi.com/groups/{EnvVar("AZURE_POWERBI_WORKSPACE_ID").get_value()}/reports/{data.properties["id"]}", + group_name="BI", + tags={"core_kpis":"","dagster-powerbi/asset_type": "report"}) def get_semantic_model_spec(self, data: PowerBIContentData) -> AssetSpec: spec = super().get_semantic_model_spec(data) return replace_attributes( spec, + description=f"Semantic model link: https://app.powerbi.com/groups/{EnvVar("AZURE_POWERBI_WORKSPACE_ID").get_value()}/datasets/{data.properties["id"]}/details", group_name="BI", deps=[AssetKey(path=[dep.asset_key.path[1].upper(), dep.asset_key.path[2]]) for dep in spec.deps], tags={"core_kpis":"","dagster-powerbi/asset_type": "semantic_model"}) def get_dashboard_spec(self, data: PowerBIContentData) -> AssetSpec: - return super().get_dashboard_spec(data)._replace(group_name="BI") + spec = super().get_dashboard_spec(data) + return replace_attributes( + spec, + group_name="BI" + ) def get_data_source_spec(self, data: PowerBIContentData) -> AssetSpec: - return super().get_data_source_spec(data)._replace(group_name="BI") + spec = super().get_data_source_spec(data) + return replace_attributes( + spec, + group_name="BI" + ) powerbi_assets = [ build_semantic_model_refresh_asset_definition(resource_key="power_bi", spec=spec)