Help Shape the Future of Dataiku Join our User Research Program

API to create a directory under a managed folder not local

Solved!
gnaldi62
Level 4
Level 4
API to create a directory under a managed folder not local

Hi again, 

  I've a managed folder under HDFS and want to create a subfolder under it but cannot find under the

  API documentation the method or the function to do it. How can this be done ? It should be possible

  because from the UI that is possible...

Thanks. Regards.

  Giuseppe 

0 Kudos
1 Solution
fchataigner2
Dataiker
Dataiker

since the notion of folder does not exist for all connection types that you can put managed folders on (as in: it doesn't exist for cloud storages), the is no API to directly create directories inside managed folders. The directories are automatically created as needed when you write a file. For example calling https://doc.dataiku.com/dss/latest/python-api/managed_folders.html#dataiku.Folder.upload_data with `upload_data("/subdir1/subdir2/stuff", [])` will create the sub-directories subdir1 and subdir2 if they don't exist. You could write empty files to force directories to be created.

View solution in original post

2 Replies
fchataigner2
Dataiker
Dataiker

since the notion of folder does not exist for all connection types that you can put managed folders on (as in: it doesn't exist for cloud storages), the is no API to directly create directories inside managed folders. The directories are automatically created as needed when you write a file. For example calling https://doc.dataiku.com/dss/latest/python-api/managed_folders.html#dataiku.Folder.upload_data with `upload_data("/subdir1/subdir2/stuff", [])` will create the sub-directories subdir1 and subdir2 if they don't exist. You could write empty files to force directories to be created.

View solution in original post

daida
Level 2

Hi fchataigner2,

the upload_data() only exists in dataiku package. How can I do it outside of DSS? In the dataikuapi package there is no this method but put_file(). However put_file() doesn't create the subdirectory automatically like upload_data().

0 Kudos
A banner prompting to get Dataiku DSS