Survey banner
Switching to Dataiku - a new area to help users who are transitioning from other tools and diving into Dataiku! CHECK IT OUT

Script for modifiying the HDFS connection paths

Level 3
Script for modifiying the HDFS connection paths

Hi Team,

I have created a script to modify the connection details specificaly the HDFS "path", but facing an error which says 
script : 

import dataiku
import prettyprinter
client = dataiku.api_client()
dss_connections = client.list_connections()
for connection in dss_connections:
 dss_connections = client.get_connection(name)
 connection_definition['root'] = Abc

Error : 

TypeError                                 Traceback (most recent call last
      5 for connection in dss_connections:
----> 6     name=connection['Testing']
      7     #dss_connections = client.get_connection(name)
      8     #con_defination=dss_connections.get_definition()

TypeError: string indices must be integers

 can some one please assist i  need to modify 100 of connection at the same time 

0 Kudos
1 Reply

Please always post your code using the Code block. This should do what you want:

client = dataiku.api_client()
all_connections = client.list_connections()
for connection in all_connections:
    connection_handle = client.get_connection(connection)
    connection_definition = connection_handle.get_definition()
    if connection == 'some_connection_name':
        connection_definition['params']['root'] = '/test/worked'
0 Kudos