Using Managed Folder from Outside Dataiku
Hello,
I need to access binary files from a container. The dataiku.Folder class doesn't work and I am using dataikuapi.dss.managedfolder.DSSManagedFolder instead because it is like calling the folder from outside Dataiku. I need to read a file from this folder, for that I am using the get_file() method. How can I get the file content in binary after that? And how can I write a binary file to DSSManagedFolder?
Thank you!
Best Answer
-
Hi,
in a container you indeed can't use direct-access APIs like get_path() (for obvious reasons). Instead you need to use https://doc.dataiku.com/dss/latest/python-api/managed_folders.html#dataiku.Folder.get_download_stream and https://doc.dataiku.com/dss/latest/python-api/managed_folders.html#dataiku.Folder.upload_stream (or one of the upload_*** variants). The equivalent in the public API is get_file() and put_file() as yoiu've found.