Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Added on November 2, 2020 11:32AM
Likes: 0
Replies: 2
Hi community,
just a small question.
If I would like to create a new project from python, I can use the create_project() function from the dssclient.py. The definition is
def create_project(self, project_key, name, owner, description=None, settings=None, project_folder_id=None)
However, I am not sure how I can set the project_folder_id.
I am able to create a new project inside the root folder (on my test machine), but of course in my situation the users are not allowed to create projects inside the root folder (only inside their own project folders.
Thanks in advance for your response,
Marc Robert
Hi,
The project folder id that needs to be used in create_project function could be taken from the URL of the project folder page like
...project-list/i5mqS6T#testfolder
otherwise, you can find it using API:
root = c.get_project_folder("") [i.id for i in root.list_child_folders()]
So in that case the call to create_project would be like:
c.create_project("test","test", "user1", project_folder_id="i5mqS6T")
Also, I don't know if you've seen the Project Creation Macro feature:
https://doc.dataiku.com/dss/latest/plugins/reference/project-creation-macros.html
It seems like it could be helpful in your case. If you have exactly 1 folder per user you could select it filtering the list of all folders using:
project_folder.get_settings().get_owner()
Also from DSS 8.0.3 it'll be possible to add dynamic dropdowns to the project creation UI, so you could offer a user to select from a list of available project folders.
Thank you Andrey,
I will look into this.