I've found the following pattern to be very useful...
# dagster-feedback
r
I've found the following pattern to be very useful alongside modern IDE code navigation tools and just generally to avoid miscoding dependencies:
Copy code
import external_asset from other_asset_module

@asset(ins={"input": AssetIn(key=external_asset.key))
def new_asset(input):
    ...
my only problem is that this interacts very poorly with the current
load_assets_from_modules
utilities you recommend since it will collect
external_asset
as well! This can become particularly confusing if
group_name
or a prefix is applied in the
load_*
function. Any recommendations or ways to support this style?
d
perhaps the other package should expose a module with only SourceAssets?
r
source assets are also picked up by
load_assets_from_modules
I think
d
but that's what you want, no? if you asset depends on an external asset, it should be represented as SourceAsset
r
It's in the same code location/repo, just a different module for organizational purposes. What I want is that if I do
load_assets_from_modules
on the module containing the above code, it retrieves
new_asset
but not
external_asset
(since I might need to apply a different group name/prefix to the latter). I believe it's recommended in the docs to use the
load_*
functions to populate
Definitions
and set group names on a module level.
current workarounds would be: • define the asset key as a variable and import that instead • set group names on assets manually and import manually into
Definitions
module •
d
oh I see, thank you, this makes sense