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

harpreet96
harpreet96 Dataiku DSS Core Designer, Registered Posts: 2 ✭✭✭

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

Best Answer

  • Zach
    Zach Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 153 Dataiker
    edited July 17 Answer ✓

    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

Answers

  • ArvinUbhi
    ArvinUbhi Dataiku DSS Core Designer, Registered Posts: 16 ✭✭✭✭

    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!

Setup Info
    Tags
      Help me…