Skip to content

Commit

Permalink
[dagster-looker] Update Looker docs to use translator instance and Lo…
Browse files Browse the repository at this point in the history
…okerApiTranslatorStructureData
  • Loading branch information
maximearmstrong committed Dec 27, 2024
1 parent de80f7a commit eb74935
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
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.
9 changes: 5 additions & 4 deletions docs/content/integrations/looker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ By default, Dagster will generate asset specs for each Looker asset based on its
```python file=/integrations/looker/customize-looker-assets.py
from dagster_looker import (
DagsterLookerApiTranslator,
LookerApiTranslatorStructureData,
LookerResource,
LookerStructureData,
LookerStructureType,
load_looker_asset_specs,
)
Expand All @@ -109,7 +109,9 @@ looker_resource = LookerResource(


class CustomDagsterLookerApiTranslator(DagsterLookerApiTranslator):
def get_asset_spec(self, looker_structure: LookerStructureData) -> dg.AssetSpec:
def get_asset_spec(
self, looker_structure: LookerApiTranslatorStructureData
) -> dg.AssetSpec:
# We create the default asset spec using super()
default_spec = super().get_asset_spec(looker_structure)
# We customize the team owner tag for all assets,
Expand All @@ -125,8 +127,7 @@ class CustomDagsterLookerApiTranslator(DagsterLookerApiTranslator):


looker_specs = load_looker_asset_specs(
looker_resource,
dagster_looker_translator=CustomDagsterLookerApiTranslator,
looker_resource, dagster_looker_translator=CustomDagsterLookerApiTranslator()
)
defs = dg.Definitions(assets=[*looker_specs], resources={"looker": looker_resource})
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dagster_looker import (
DagsterLookerApiTranslator,
LookerApiTranslatorStructureData,
LookerResource,
LookerStructureData,
LookerStructureType,
load_looker_asset_specs,
)
Expand All @@ -16,9 +16,11 @@


class CustomDagsterLookerApiTranslator(DagsterLookerApiTranslator):
def get_asset_spec(self, looker_structure: LookerStructureData) -> dg.AssetSpec:
def get_asset_spec(
self, looker_structure: LookerApiTranslatorStructureData
) -> dg.AssetSpec:
# We create the default asset spec using super()
default_spec = super().get_asset_spec(looker_structure) # type: ignore
default_spec = super().get_asset_spec(looker_structure)
# We customize the team owner tag for all assets,
# and we customize the asset key prefix only for dashboards.
return default_spec.replace_attributes(
Expand All @@ -32,7 +34,6 @@ def get_asset_spec(self, looker_structure: LookerStructureData) -> dg.AssetSpec:


looker_specs = load_looker_asset_specs(
looker_resource,
dagster_looker_translator=CustomDagsterLookerApiTranslator, # type: ignore
looker_resource, dagster_looker_translator=CustomDagsterLookerApiTranslator()
)
defs = dg.Definitions(assets=[*looker_specs], resources={"looker": looker_resource})
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
)
from dagster_looker.api.dagster_looker_api_translator import (
DagsterLookerApiTranslator as DagsterLookerApiTranslator,
LookerApiTranslatorStructureData as LookerApiTranslatorStructureData,
LookerStructureData as LookerStructureData,
LookerStructureType as LookerStructureType,
RequestStartPdtBuild as RequestStartPdtBuild,
Expand Down

0 comments on commit eb74935

Please sign in to comment.