Default project: How is it set? When is it not valid?

Solved!
MarkPundurs
Level 3
Default project: How is it set? When is it not valid?

https://doc.dataiku.com/dss/latest/python-api/client.html says dataiku.get_default_project() "gets a handle to the current default project, if available (i.e. if dataiku.default_project_key() is valid)".

How is the default project set? When is dataiku.default_project_key() NOT valid? Can I rely on the default project being the project from within which I call get_default_project()?

0 Kudos
1 Solution
sergeyd
Dataiker

Hi @MarkPundurs 

Yes, "get_default_project()" will return the "DSSPoject object" of the current project from where you are executing the code. If "default_project_key()" is not valid for some reason, the "get_default_project()"  function will not return the DSSPoject object. 

In case you want to access another project from the current one, please use: 

client = dataiku.api_client()
client.get_project("<PROJECT_KEY>")

Hope this helps. 

View solution in original post

1 Reply
sergeyd
Dataiker

Hi @MarkPundurs 

Yes, "get_default_project()" will return the "DSSPoject object" of the current project from where you are executing the code. If "default_project_key()" is not valid for some reason, the "get_default_project()"  function will not return the DSSPoject object. 

In case you want to access another project from the current one, please use: 

client = dataiku.api_client()
client.get_project("<PROJECT_KEY>")

Hope this helps.