Recently upgraded dagster and dagster_dbt, and not...
# integration-dbt
r
Recently upgraded dagster and dagster_dbt, and notice all my dbt assets are in the
default
asset gorup. Previously I could use the
key_prefix
arg when calling
load_assets_from_dbt_project
, and the dbt assets would be in an asset group with the name of the key_prefix, but that no longer seems to work.
Copy code
dbt_assets = load_assets_from_dbt_project(
    project_dir=DBT_PROJECT_PATH,
    profiles_dir=DBT_PROFILES,
    # key_prefix=["categorization"], #The old way that worked
    dagster_dbt_transator=CatModuleDagsterDbtTranslator(), # The new way that I need to use
)
shows the difference. I also need to define a class just to specify the name
Copy code
class CatModuleDagsterDbtTranslator(DagsterDbtTranslator):
....
    def get_group_name(self, dbt_resource_props: Mapping[str, Any]) -> Optional[str]:
        return "categorization"
Is this intended behaviour? Edit: wrote dagster_dbt_resource, meant dagster_dbt_translator of course.
b
This is my understanding also. I think the requirement to create a new class is surprising, given it's a
@classmethod
override.
r
Perhaps there's another way, I'm only just figuring it out. I also noticed the the prefixes are gone (as expected since I removed key_prefix). I also found that updating
get_asset_key
did not work
Copy code
class CatModuleDagsterDbtTranslator(DagsterDbtTranslator):
    @classmethod
    def get_asset_key(cls, dbt_resource_props: Mapping[str, Any]) -> AssetKey:
        answer = super().get_asset_key(dbt_resource_props).with_prefix("the_key_prefix")
        return answer

    def get_group_name(self, dbt_resource_props: Mapping[str, Any]) -> Optional[str]:
        return "categorization"
still gives me
but the dependencies are looking for So a lot of stuff is orphaned (I assume there's still no way to throw an exception when a dependency isn't found?)