You now have until September 15th to submit your use case or success story to the 2022 Dataiku Frontrunner Awards!ENTER YOUR SUBMISSION

Create and populate Editable Datasource with API

benmoss
Level 1
Level 1
Create and populate Editable Datasource with API

Hi!

I'm looking at the different API end-points in regards to creating datasources.

Specifically in this case I am looking for a method of initially creating an editable datasource and then populating that editable datasource with data.

The first part seems possible but I can't see any documentation to say that the 2nd part is also. Has anyone tried to do anything similar?

Simple table to load as an example.

PersonAge
Ben31
Charlotte28

 

Ben

0 Kudos
1 Reply
Emma
Dataiker
Dataiker

Hey @benmoss ,

Great questions. Editable Datasets are really meant to be modified through the UI. 

However, if you have need to use them then a workaround was detailed in this Community post: https://community.dataiku.com/t5/Using-Dataiku/Can-we-write-to-a-editable-dataset-using-Python-API/m... 

If your use case can be served without having an Editable Dataset (you are hoping to create and then populate a dataset entirely programmatically) you can do so with the generic Dataiku Dataset API: 

# Get the Dataiku client 
client = dataiku.api_client()
project = client.get_project("ProjectKey")

# Create the Dataset
builder = project.new_managed_dataset("mydatasetname")
builder.with_store_into("TargetLocation")
dataset = builder.create()

# Now modify the Dataset in some way
mydatasetname = ... 

Hope that helps, 

Emma 

0 Kudos