How to create a managed folder using Python and upload csv files to it

Solved!
VickeyC
Level 3
How to create a managed folder using Python and upload csv files to it

I'm receiving this error when I try to create a managed folder in Python:  

"

Job failed: Error in Python process: At line 22: <class 'dataikuapi.utils.DataikuException'>: com.dataiku.dip.server.services.licensing.AbstractLicenseFeaturesStatusBuilder$LicenseFeatureException: Your license does not allow you to create a dataset of type /app/dataiku/user_defined/MANAGE_UDMS/definitions/"

Here's my code:

# -*- coding: utf-8 -*-
import dataikuapi

# Define the client, project, and dataset handles
host = "xxx"
apiKey = "xxx"
client = dataikuapi.DSSClient(host, apiKey)
project = client.get_default_project()
client._session.verify = False

# Define the dataset name and folder paths
dataset_name = "user_defined_meanings"
source_file_path = "/tmp/UDM/meanings_def/UserDefinedMeanings.csv"
folder_path = "/app/dataiku/user_defined/MANAGE_UDMS/definitions/"

# Create the dataset folder if it doesn't exist
if not project.get_managed_folder(folder_path):
project.create_managed_folder(folder_path)

# Create the dataset
dataset = project.create_dataset(dataset_name, folder_path, "ManagedFolder")

# Upload the csv file
with open(source_file_path, "r") as f:
dataset.upload.data(f.read(),format="csv")

 

What am I doing wrong?


Operating system used: RHEL 7.9

0 Kudos
1 Solution
CatalinaS
Dataiker

Hi @VickeyC,

Your code tries to create a dataset type "/app/dataiku/user_defined/MANAGE_UDMS/definitions/" and this type doesn't exist in DSS. You should create the dataset as suggested here.

View solution in original post

0 Kudos
1 Reply
CatalinaS
Dataiker

Hi @VickeyC,

Your code tries to create a dataset type "/app/dataiku/user_defined/MANAGE_UDMS/definitions/" and this type doesn't exist in DSS. You should create the dataset as suggested here.

0 Kudos