Saving a datframe as a csv into a managed folder from python endpoint

ssuhas76
Level 3
Saving a datframe as a csv into a managed folder from python endpoint

Hello,

 

I am trying to export a dataframe as a csv file into a managed folder from the endpoint python function. 

How can this be done?

0 Kudos
4 Replies
Turribeach

What exactgly do you mean by endpoint python function? Please explain your requirement properly. And API endpoint function is supposed to respond to API calls via REST. Why would you want to return data via a managed folder? It makes no sense. 

0 Kudos
ssuhas76
Level 3
Author

I should have framed my question in a better way. We are receving some data in JSON which we convert into a dataframe. This dataframe is supposed to be stored as a csv file in a managed folder. How can i accomlish this?

0 Kudos
Turribeach

This is still not clear to me. How are you receiving this data? Is it using an Dataiku API endpoint function running in the API node? If so, why can't you respond to the API request with your data in JSON? there is no concept of managed folder in the API node. Like in the other answer I gave you you will need to use the Dataiku API to go back to the Designer Node. 

0 Kudos
ssuhas76
Level 3
Author

Let me rephrase this again. I am completely struck this issue. 

 

I have the below code in my API endpoint function which obviuosly will run outside of Dataiku. 

 

client = dataikuapi.DSSClient(host, apiKey)
client._session.verify = False
project = client.get_project("proj-name")

managedfolder = project.get_managed_folder("folder-name")

 

I need to export some data into a csv file which I need to store in the managed folder. How can i accomplish this?

0 Kudos