Brandon Freeman
02/21/2024, 5:26 PM1.5.9
to 1.6.5
and getting some breaking behavior that I want to verify.
Before running my dbt models, I have an asset that generates numerous raw tables in Snowflake. For my use case, it doesn't make sense to have these be different assets. They're dynamic - one day there could be 30 the next there could be 40. Nor do I care about the majority of them within the context of Dagster. I most definitely want them written as raw tables to Snowflake, but aside from that only a select few of them are of use in Dagster or dbt. Only a subset of those tables serve as my source tables to some of my dbt staging models.
In 1.5.9
I simply assigned all of the source tables to the same asset key and everything would worked as expected. My dependency graph was one asset that splits out into ~20 dbt staging models asset that carry on from there.
I don't need the source tables to be their own assets within Dagster. That'd be inefficient and create unnecessary clutter. Is there still a way to accomplish this? Or is Dagster enforcing granularity here?Brandon Freeman
02/21/2024, 7:18 PMrex
02/21/2024, 9:59 PMThey're dynamic - one day there could be 30 the next there could be 40.If you use
get_asset_keys_by_output_name_for_source
(link), you can generate the asset keys associated with your dbt source in a dynamic way. Does that help?Brandon Freeman
02/21/2024, 10:08 PMStephen Bailey
02/22/2024, 2:24 PMBrandon Freeman
02/22/2024, 3:28 PMStephen Bailey
02/22/2024, 4:03 PMBrandon Freeman
02/22/2024, 4:45 PMStephen Bailey
02/22/2024, 6:17 PMStephen Bailey
02/22/2024, 6:18 PMBrandon Freeman
02/22/2024, 6:54 PMv1.5.9
nothing was awry or awkward, everything behaved as expected, I leveraged all the features, there were no conflicts, etc. I could certainly be wrong but I see no possible way it could truly break anything. It's just an opinionated constraint and not required to interface Dagster and dbt. I'm curious if @rex could set me straight on there.
I could certainly create a single table that has all the data I need for all the downstream models - the intermediary asset creates all tables with the same generic schema so they align - and use it as a singleton dbt source model to align with my upstream Dagster asset, but why? Everyone would think that's silly. Why is it not silly the other way around - contorting my upstream Dagster asset to align with how dbt references a source?Stephen Bailey
02/22/2024, 7:00 PMI simply assigned all of the source tables to the same asset key
-- is unexpected / misaligned with expected topology of an asset graph. (i.e. one "thing" meaning many "things") But I get that there can be good reasons for it and that it's frustrating for the behavior to break on you.Brandon Freeman
02/22/2024, 7:04 PMBrandon Freeman
02/24/2024, 1:46 AMrex
03/06/2024, 4:53 PMDagsterDbtTranslatorSettings
called enable_duplicate_source_asset_keys
that relaxes the duplicate asset key constraint for dbt sources.
This will enable the behavior that you had before.
Thanks for the feedback + collaborating on this @Brandon Freeman!