Skip to content

Commit

Permalink
[dagster-tableau] Update Tableau docs to use translator instance and …
Browse files Browse the repository at this point in the history
…TableauTranslatorData
  • Loading branch information
maximearmstrong committed Dec 27, 2024
1 parent 2721f82 commit d8d96f0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 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.
7 changes: 4 additions & 3 deletions docs/content/integrations/tableau.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ from dagster_tableau import (
TableauCloudWorkspace,
load_tableau_asset_specs,
)
from dagster_tableau.translator import TableauContentData, TableauContentType
from dagster_tableau.translator import TableauContentType, TableauTranslatorData

import dagster as dg

Expand All @@ -126,7 +126,7 @@ tableau_workspace = TableauCloudWorkspace(
# A translator class lets us customize properties of the built
# Tableau assets, such as the owners or asset key
class MyCustomTableauTranslator(DagsterTableauTranslator):
def get_asset_spec(self, data: TableauContentData) -> dg.AssetSpec:
def get_asset_spec(self, data: TableauTranslatorData) -> dg.AssetSpec:
# We create the default asset spec using super()
default_spec = super().get_asset_spec(data)
# We customize the metadata and asset key prefix for all assets, including sheets,
Expand All @@ -143,7 +143,8 @@ class MyCustomTableauTranslator(DagsterTableauTranslator):


tableau_specs = load_tableau_asset_specs(
tableau_workspace, dagster_tableau_translator=MyCustomTableauTranslator
tableau_workspace,
dagster_tableau_translator=MyCustomTableauTranslator(),
)
defs = dg.Definitions(assets=[*tableau_specs], resources={"tableau": tableau_workspace})
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
TableauCloudWorkspace,
load_tableau_asset_specs,
)
from dagster_tableau.translator import TableauContentData, TableauContentType
from dagster_tableau.translator import TableauContentType, TableauTranslatorData

import dagster as dg

Expand All @@ -20,9 +20,9 @@
# A translator class lets us customize properties of the built
# Tableau assets, such as the owners or asset key
class MyCustomTableauTranslator(DagsterTableauTranslator):
def get_asset_spec(self, data: TableauContentData) -> dg.AssetSpec:
def get_asset_spec(self, data: TableauTranslatorData) -> dg.AssetSpec:
# We create the default asset spec using super()
default_spec = super().get_asset_spec(data) # type: ignore
default_spec = super().get_asset_spec(data)
# We customize the metadata and asset key prefix for all assets, including sheets,
# and we customize the team owner tag only for sheets.
return default_spec.replace_attributes(
Expand All @@ -38,6 +38,6 @@ def get_asset_spec(self, data: TableauContentData) -> dg.AssetSpec:

tableau_specs = load_tableau_asset_specs(
tableau_workspace,
dagster_tableau_translator=MyCustomTableauTranslator, # type: ignore
dagster_tableau_translator=MyCustomTableauTranslator(),
)
defs = dg.Definitions(assets=[*tableau_specs], resources={"tableau": tableau_workspace})

0 comments on commit d8d96f0

Please sign in to comment.