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

Rasmus Bonnevie

02/14/2023, 10:57 AM
are there any examples of using `materialize_to_memory`to test DAGs that depend on
SourceAsset
or assets that I otherwise want to mock? The docs describe the assets argument to the function as: "The assets to materialize. Can also provide
SourceAsset
objects to fill dependencies for asset defs." but how does that dependency filling actually work seeing as the
SourceAsset
has no value and the io manager is forced to the in-memory kind?
g

geoHeil

02/14/2023, 11:20 AM
do you need an explicit memory IO manager for this?
r

Rasmus Bonnevie

02/14/2023, 12:17 PM
I think it defaults to the standard in-memory manager for all assets? But unsure if I need to overwrite it to load the mock source assets.
g

geoHeil

02/14/2023, 1:11 PM
defaults indeed - my question rather was if you specify a real IO manager and want to mock/stub it out during tests especially if IO is based on side effects i.e. DBT materializing stuff how this works E2E
r

Rasmus Bonnevie

02/14/2023, 1:27 PM
yes, I do use a custom IO manager for my source assets. In this case it's just some dataframes, but I did encounter the same issue with DBT also - as you hint at, a DBT asset raises an error if you try loading it with the default in-memory IO manager, so it doesn't play well with
materialize_to_memory
.
8 Views