Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Dear Community,
I am trying to rename a dataset from a project using the python API using the rename method from the dataikuapi.dss.dataset.DSSDataset class (https://developer.dataiku.com/latest/api-reference/python/datasets.html#dataikuapi.dss.dataset.DSSDa...) but I get an
AttributeError: 'DSSDataset' object has no attribute 'rename'
How can I rename a dataset using the python API?
Here is the code I am trying:
client = dataiku.api_client()
project = client.get_default_project()
dataset_infos = [(dataset['smartName'], dataset['type']) for dataset in project.list_datasets()]
for dataset_name, dataset_type in dataset_infos:
name = re.sub(r'LAYER\d{1}_?', '', dataset_name)
if name[:5]!='temp_':
name = 'temp_'+name
if name!=dataset_name:
dataset = project.get_dataset(dataset_name)
dataset.rename(name)
Many Thanks for your help
What version of Dataiku do you have? The rename datasets API only got added in 12.5.0 which is only a week old:
https://doc.dataiku.com/dss/latest/release_notes/12.html#apis-and-coding-experience
What version of Dataiku do you have? The rename datasets API only got added in 12.5.0 which is only a week old:
https://doc.dataiku.com/dss/latest/release_notes/12.html#apis-and-coding-experience
Oh that's why, it seems like my version is 12.2.3, I did not think the method was that new ๐
Thank you so much.
PS: Tested your code in v12.5.0 and it works fine, the dataset is indeed renamed.