# Programmatic dataset imports

**URL:** <https://renku.discourse.group/t/programmatic-dataset-imports/251>\
**Category:** Renku (CLI)\
**Created:** [17 February 2021 15:49 UTC](https://renku.discourse.group/t/programmatic-dataset-imports/251 "2021-02-17T15:49:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mitch](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@mitch](https://renku.discourse.group/u/mitch)\
**Post date:** [17 February 2021 15:49 UTC](https://renku.discourse.group/t/programmatic-dataset-imports/251/1 "2021-02-17T15:49:05Z")

</div>

Hey guys, question about datasets imports. I was extremely happy using

```auto
from renku.core.commands import dataset

...

dataset.import_dataset(uri=link, commit_message=message)

```

kind of things, to programmatically import several datasets as provided by a list, and was working fine on `renku 0.12.3` I updated it to `0.13.0` and now things have changed and i no longer can do the same. That is fine, but made me wonder if there is some agreed way of importing datasets form lists programatically using python? or is something that is bound to evolve again substantially?

I pin the renku version from now on, but I suspect that is not really a maintainable solution and I should stick to fresher software, I guess…

Thanks a ton for any pointer, all the best guys!

---

<div class="post-metadata">

**Author:** ![mohammad-sdsc](https://yyz2.discourse-cdn.com/free1/user_avatar/renku.discourse.group/mohammad-sdsc/32/79_2.png) [@mohammad-sdsc](https://renku.discourse.group/u/mohammad-sdsc)\
**Post date:** [17 February 2021 17:06 UTC](https://renku.discourse.group/t/programmatic-dataset-imports/251/2 "2021-02-17T17:06:47Z")

</div>

Hi Michele,

There were some changes in the way we call renku command functions. To do the same thing as before:

```auto
from renku.core.commands.dataset import import_dataset
from renku.cli.utils.callback import StandardOutput

import_dataset().with_communicator(StandardOutput()).with_commit_message(message).build().execute(uri=link, yes=True)

```

Depending on where you run this, you might not see console messages. This call returns a `renku.core.incubation.command.CommandResult` object that you can check to see its output. If there is an error then an exception is raised.

On a different note, we’ve added a renku API that provides an easier way to work with renku repos. ATM it does not do much (and doesn’t support dataset import) but you still can see the basic idea behind it: [Renku Python API — Renku 0.13.1.dev16 documentation](https://renku-python.readthedocs.io/en/latest/api.html).

Cheers,  
Mohammad
