https://dagster.io/ logo
#ask-community
Title
# ask-community
j

Jean Gonzalez

02/27/2023, 3:03 PM
I have a similar question, is there a way to include those source asset in the same group?
🤖 1
a

Adam Bloom

02/27/2023, 3:28 PM
@Jean Gonzalez (cc @Saul Burgos) - you just need to pass a custom
node_info_to_group_fn
- it can literally return a static string if you want everything in the same group
s

Saul Burgos

02/27/2023, 3:32 PM
Yes I am doing that but sources are not included into the group
s

sandy

02/27/2023, 4:49 PM
load_assets_from_dbt_project
doesn't return any
SourceAsset
objects. if you want to put those source asset in a group, you'll need to create
SourceAsset
objects and assign the group to them
s

Saul Burgos

02/27/2023, 5:20 PM
Thanks But that it will not hide original source node right (gray square)? let me see if understand this: create "sourceAsset" and put the original source like upstream to this new one?
Or I will have both not related
Question once "load_assets_from_dbt_project" is executed I only have a List[AssetsDefinition]. , should iterate over this and add the new "SourceAsset" ? what method of "AssetDefinition" can I use for that?
s

sandy

02/28/2023, 12:07 AM
backing up a bit, I'm not actually entirely sure where the gray squares are coming from. if you have a dbt project with a single model and a single dbt source, I'd expect it to look something like this, and model0 wouldn't apply to any group:
are you explicitly defining assets that correspond to the dbt sources somewhere?
s

Saul Burgos

02/28/2023, 2:11 PM
Hi, I have a dbt project with 3 sources. The "Gray squares" are just visual and depend of the option you use to see the lineage. EX: if you click on the items using the left panel you will see them like your image, but if you use the option "*View global asset lineage*" you will see them like my example. Thanks for your answer. So sources can not group. Returning to your first answer of using an "SourceAsset". Could you give a guide about how to do it? Because the idea is load my repository by code. Let me explain my use case: 1 - I have a service that is creating dbt projects on the fly and putting them into a single folder, So I don't know how many dbt projects could be into this folder. 2- all the models and sources are unknow, because all of them are create by other services So I need to load all this in dagster and the "nice to have" will be have sources also include inside the group of models using "node_info_to_group_fn"
s

sandy

02/28/2023, 4:01 PM
Thanks for your answer. So sources can not group. Returning to your first answer of using an "SourceAsset". Could you give a guide about how to do it?
Suppose one of your dbt sources has the key ["marketing", "campaigns"] You can do
Copy code
campaigns = SourceAsset(AssetKey(["marketing", "campaigns"]), group_name="whatever")
s

Saul Burgos

02/28/2023, 9:18 PM
Thanks works perfect
3 Views