geoHeil
08/14/2023, 12:59 PMsource_key_prefix
map to the new DBT API? node_info_to_asset_key
(https://github.com/dagster-io/dagster/discussions/14477) no longer seems to be available in the latest version? For the normal prefix operation https://docs.dagster.io/integrations/dbt/reference#loading-dbt-models-from-a-dbt-project lists the
self.get_asset_key(dbt_resource_props).with_prefix("snowflake")
but that is not tackling/documenting the source_key_prefixrex
08/14/2023, 1:26 PMdbt_resource_props
to scope the change only for sources.
from typing import Any, Mapping
from dagster import AssetKey
from dagster_dbt import DagsterDbtTranslator
class CustomDagsterDbtTranslator(DagsterDbtTranslator):
@classmethod
def get_asset_key(cls, dbt_resource_props: Mapping[str, Any]) -> AssetKey:
asset_key = super().get_asset_key(dbt_resource_props)
if dbt_resource_props["resource_type"] == "source":
asset_key = asset_key.with_prefix("my_prefix")
return asset_key
geoHeil
08/14/2023, 1:31 PMgeoHeil
08/14/2023, 1:31 PM