How do I manually materialize an asset which is no...
# ask-community
d
How do I manually materialize an asset which is not included in the job selection? I'd like to sometimes "reset" an asset and have a special job for doing that. Currently it just writes data at the asset's location (the path is hardcoded). I'd like to materialize it properly (getting all the logged metadata, using the correct IOManager, etc). I assume I would have to use
get_output_context
or
build_output_context
and pass it to the
IOManager.handle_output
along with my object, right?
j
hi @Daniel Gafni are you trying to materialize the asset from a script or some other non-UI way?
d
From a job which I occasionally launch from Dagit
The thing is - this special job constructs it differently, not like it’s usually obtained from the asset graph
Let’s say I have an append-only table as an asset. Every asset materialization appends some data to this table. Sometimes I would like to reset this table to have some specific contents. Instead of appending I would overwrite it with some data.
j
ahhh i see. one thing you could do is yield an AssetMaterialization event from the job that modifies the asset to indicate to dagster that the asset has been changed. Let me think on some other options. maybe @sandy might have some ideas too?
d
I’d like to automatically include the correct metadata too. Like the IOManager would do. I would have to calculate it manually in this case.
I just learned about
input_values
argument of
@job
. Perhaps we could have something similar for this case like
output_assets
?