Change connection and variable of deployment in project deployer using python API

dataikubest
dataikubest Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 8

Once I create a deployment, is there a way to update 'connections' and 'variables' so that I can deploy and activate?

Answers

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,171 Neuron
    edited July 2024

    You will be way better to add the connections mapping in your deployment settings so that all the connections will be remapped automatically by the Deployer. As for the project variables you shouldn't need to change these if you use Local variables for your Designer node and Global variables for your Automation node (since Local variables are not included in the project bundle). However if you have a multiple environment setup you can update project variables as follows:

    import dataiku
    client = dataiku.api_client()
    
    project = client.get_project(dataiku.get_custom_variables()['projectKey'])
    project_variables = project.get_variables()
    project_variables['standard']['Sample_ratio'] = 0.001
    project_variables = project.set_variables(project_variables)

Setup Info
    Tags
      Help me…