Hello! I am starting to learn dagster's partition...
# ask-community
d
Hello! I am starting to learn dagster's partitioning. Is there a way to be able to "Wipe materializations" for a specific asset programmatically (not using dagit UI) and not using CLI? I want to wipe or erase the materializations using dagster code somehow. I have an asset that has static partitioning and I want to be able to refresh it. So my thinking is I would have a task that deletes/empties my asset, then wipe/erase the materializations, then I can proceed to materialize the partitions. Not sure if this makes sense or I should be going about it differently.
t
You mentioned the CLI, so I assume you're familiar with
dagster asset wipe
? If that's the case, then you can use the function that it uses under the hood to programmatically do it yourself.
DagsterInstance.get().wipe_assets([AssetKeys])
d
Yes I am familiar! Thanks @Tim Castillo!
🎉 1
t
Awesome! If you want some direction, you can also look at the code for how
dagster asset wipe
uses it. https://github.com/dagster-io/dagster/blob/c5e33e782b7148dd27574d0b55b8acb7edb07fda/python_modules/dagster/dagster/_cli/asset.py#L156