I am trying to rename the key prefix of an asset, ...
# ask-community
c
I am trying to rename the key prefix of an asset, but when i do i lose all history of that asset. how do i do it gracefully? šŸ¤” āš ļø the rename is essentially
A/B/asset
to
/raw/A/asset
šŸ‘€ 1
v
Probably need to migrate it in the backend instance too, my guess would be in the
runs
table, but it might involve some json parsing of the
run_body
object
c
in the database, you mean? The actual job history remains, which is neat, however the asset loses all sense of identity. Afaik it had worked in the past, but i might be wrong?
v
Yep, my understanding (which might be wrong) is that Dagster maps previous run informations to the targeted assets based on the asset keys, so changing an asset key would require changing the target path of its previous run in order for its history to be retained
c
true. Can one manually, through the ui, mark an asset as materialized, without actually running it?
v
I think you can emit AssetMaterialization events through an Op without materializing anything, remember seeing this question answered somewhere else.
c
Yeahokay.
v
But for the full history move Iā€™d probably ask someone from the Elementl team. Maybe @owen could have more reliable info than my wild guesses?
c
I think we'll just do a full backfill over the weekend. For most assets (which are monthly) it isn't an issue. we just have sensor data that is hourly, a few years back, and reloading thousands of partitions for no particular reason is just.. annoying - but it's not a massive issue
v
I think it would be cool to have a CLI command
dagster asset migrate A B
, actually.
šŸ™ 1
ā¤ļø 1
o
totally agree that this is painful at the moment -- definitely on our radar (https://github.com/dagster-io/dagster/discussions/12561 / the issue linked therein), but I don't have a timeline for when that would actually get implemented unfortunately šŸ˜ž