Changing URN for Existing Datasets Programmatically

Original Slack Thread

Hi Team,
I want to change the URN for all existing dataset programatically. Is there any way to do that? Or need to delete existing datasets and re-ingest with new URN?
Also future ingestion will make sure to use the new URN format.

Something similar but not quite. You probably have to adapt the code for your use case. https://datahubproject.io/docs/next/cli/#dataplatform2instance|https://datahubproject.io/docs/next/cli/#dataplatform2instance

Thanks for looking in <@U01TCN40JKV>
It seems new URN are created based on instance name automatically but in my case, the dataset was ingested using push based method and custom URN was created at that time.
Now, I have mapping with old and new URN in someplace and want to change the existing dataset URN.

there is no out of the box way, short of writing your own code to do your use case.

the code to adapt from is at https://github.com/datahub-project/datahub/blob/master/metadata-ingestion/src/datahub/cli/migrate.py

Thanks <@U01TCN40JKV> for sharing the resources. This would be sufficient for me to write custom code for migration