Want to Stop Rebuilding "Expensive" Parts of your Flow? Explicit Builds are the Answer!READ MORE

Specifying a location when exporting a project, using DSS python REST API

Solved!
harpreet96
Level 1
Specifying a location when exporting a project, using DSS python REST API

Hi,

I am trying to export a project using a dataiku python REST API and I would like to specifying the location in which to store the project I.E. a specified path on our server that hosts Dataiku. Please see the below: 


for project_name in list_of_project_keys:
       project = client.get_project(project_name)
       project.export_to_file(project_name + '.zip')

 

On the last line, I'd like to specify the location in which to export the project to - any advise would be appreciated.


Operating system used: Linux

0 Kudos
1 Solution
ZachM
Dataiker
Dataiker

Hi @harpreet96 and @ArvinUbhi ,

The export_to_file() allows you to specify a full filepath, such as /my/dir/project.zip

The following example will export your projects to the directory specified by the BASE_DIR variable, eg /path/to/dir/PROJECT_NAME.zip

import os.path

BASE_DIR = '/path/to/dir'

for project_name in list_of_project_keys:
    project = client.get_project(project_name)
    export_path = os.path.join(BASE_DIR, project_name + '.zip')
    project.export_to_file(export_path)

The directory must already exist.

 

Thanks,

Zach

View solution in original post

2 Replies
ArvinUbhi
Level 3

Great question harpreet! Id also like to know the answer to this one - would really benefit my teams maintenance of our DSS envs. 

Ill keep posted on this one!😁

 

0 Kudos
ZachM
Dataiker
Dataiker

Hi @harpreet96 and @ArvinUbhi ,

The export_to_file() allows you to specify a full filepath, such as /my/dir/project.zip

The following example will export your projects to the directory specified by the BASE_DIR variable, eg /path/to/dir/PROJECT_NAME.zip

import os.path

BASE_DIR = '/path/to/dir'

for project_name in list_of_project_keys:
    project = client.get_project(project_name)
    export_path = os.path.join(BASE_DIR, project_name + '.zip')
    project.export_to_file(export_path)

The directory must already exist.

 

Thanks,

Zach