https://dagster.io/ logo
#dagster-support
Title
# dagster-support
b

Bennett Norman

01/19/2023, 6:14 AM
Hello! One of my Definitions has almost a hundred assets and I’m expecting to add more. For organization’s sake I thought it would make sense to have multiple Definitions where each Definition is a collection of assets that are at different stages of our full data pipeline. These Definitions would be connected using SourceAssets. Is there an easy way to convert a collection of AssetDefinitions to SourceAssets? My solution is to gather the assets from the upstream Definition and create SourceAssets from the Assets’ key and io_manager. Is there a more graceful way to do this? Is this a reasonable way to structure large dagster projects?
👀 1
🤖 1
c

chris

01/19/2023, 9:20 PM
It’s hard to know whether that’s a reasonable organization strategy without knowing the use case, but you can also make use of asset groups to help organize things - since having multiple definitions will require additional operational burden (as you’ve identified with the need to have source assets bridging the gap)
We do have utility functions for creating source assets out of assets definition objects, but they aren’t public and I’m not 100% sure why that is. cc @sandy thoughts on making those fxns public?
b

Bennett Norman

01/19/2023, 9:47 PM
Thanks! Maybe I’ll keep all of the assets in one definition for now. If think get unruly I’ll explore creating a second Definition with SourceAssets. A utility function that creates source assets from asset definitions sounds nice!
s

sandy

01/19/2023, 9:49 PM
you can call
to_source_assets()
on an asset to get a list of `SourceAsset`s
c

chris

01/19/2023, 9:49 PM
^
to_source_assets
isn’t public tho right?
s

sandy

01/19/2023, 9:50 PM
ah sorry missed what you said @chris. yeah, we should probably make it public, but you can still use it and I think it's unlikely that it will change
@Bennett Norman if you'd be up for filing a github issue about making it public, that would help us track it
b

Bennett Norman

01/19/2023, 9:51 PM
Great thanks y’all! I’ll create an issue. Is
to_source_assets
used for this situation where you want to link assets from different Definitions?
s

sandy

01/19/2023, 9:52 PM
I think that's a very legitimate way to use it
if all you care about is organizing how the assets show up in Dagit, you might find it easier to set group names on your assets
b

Bennett Norman

01/19/2023, 9:54 PM
Sounds good. Is it common to have > 100 assets in a definition?
s

sandy

01/19/2023, 9:54 PM
definitely
with large dbt projects, we sometimes see a few thousand
b

Bennett Norman

01/19/2023, 9:55 PM
Oh great. thanks for the help!
2 Views