'DSSManagedFolder' object has no attribute 'get_path'

indy2005
indy2005 Registered Posts: 21 ✭✭✭✭
edited July 16 in Using Dataiku

I am trying to use VS Code. I get constant SSL errors, so I am reverting to using dataikuapi.DSSClient.

I am trying to get the path of managed folder which is hosted on the server file system, but when I use this method I get the error:

AttributeError: 'DSSManagedFolder' object has no attribute 'get_path'

dataikuclient = dataikuapi.DSSClient("https://dataiku-design-dev.mycompany.net:11200/", "my_api_key")
dataikuclient._session.verify = False

project = dataikuclient.get_project("cdata_test")
# -------------------------------------------------------------------------------- NOTEBOOK-CELL: CODE
# get folder location for logs in Dataiku
managed_folder = project.get_managed_folder("cYurGLAG")
managed_folder_path = managed_folder.get_path()

Tagged:

Answers

  • nmadhu20
    nmadhu20 Neuron, Registered, Neuron 2022, Neuron 2023 Posts: 35 Neuron
    edited July 17

    Hi @indy2005
    ,

    For accessing the metadata of the managed folder you need to create a Folder object.

    import dataiku
    
    handle = dataiku.Folder("folder_name")
    path = handle.get_path()

    You can refer to the following Dataiku docs for some in-depth understanding -

    Hope it helps!

    Best,
    Madhuleena

  • indy2005
    indy2005 Registered Posts: 21 ✭✭✭✭

    Hi,

    I cant use the dataiku library, if I do I get SSL errors. If I use the api client, and remove certificate verification, I can do what I need to do. I dont understand why using the get_managed_folder() in the api client, doesnt then let me work with the managed folder when I get a reference to it?? The method surely returns a managed folder instance, but there is then no get_path() method.

    Unless the get_managed_folder() method on the api client, doesnt return a managed folder, which means the method is very misleading.

    SSL errors seem to be specific to using VS Code and the DataIku VS Code plugin.

    Regards


    Stephen

  • nmadhu20
    nmadhu20 Neuron, Registered, Neuron 2022, Neuron 2023 Posts: 35 Neuron

    Hi @indy2005
    ,

    I see your trouble.
    You can try the get_definition() method of DSSManagedFolder that has ['param']['path'] json keys for getting the path

    You can refer to this doc for more info - https://doc.dataiku.com/dss/6.0/python-api/rest-api-client/managed-folders.html

    Best,

    Madhuleena

  • indy2005
    indy2005 Registered Posts: 21 ✭✭✭✭

    thanks, although what would be great is a solution for not getting SSL errors when using an external IDE.

  • indy2005
    indy2005 Registered Posts: 21 ✭✭✭✭
    edited July 17

    Now I just get this using get_definition()

    File "c:\pyenv\ariel\lib\site-packages\dataikuapi\dssclient.py", line 1234, in _perform_http
    http_res.raise_for_status()
    File "c:\pyenv\ariel\lib\site-packages\requests\models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
    requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://dataiku-design-dev.mycompany.net:11200//dip/publicapi/projects/cdata_test/managedfolders/cYurHLAG
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "c:\pyenv\ariel\lib\site-packages\dataikuapi\dss\managedfolder.py", line 53, in get_definition
    return self.client._perform_json(
    File "c:\pyenv\ariel\lib\site-packages\dataikuapi\dssclient.py", line 1250, in _perform_json
    return self._perform_http(method, path, params=params, body=body, files=files, stream=False, raw_body=raw_body).json()
    File "c:\pyenv\ariel\lib\site-packages\dataikuapi\dssclient.py", line 1241, in _perform_http
    raise DataikuException("%s: %s" % (ex.get("errorType", "Unknown error"), ex.get("message", "No message")))
    dataikuapi.utils.DataikuException: com.dataiku.dip.exceptions.UnauthorizedException: Failed to read project permissions

  • indy2005
    indy2005 Registered Posts: 21 ✭✭✭✭

    @nmadhu20
    Hi, see above - doesn't work unfortunately

  • Catalina
    Catalina Dataiker, Dataiku DSS Core Designer, Registered Posts: 135 Dataiker
    edited July 17

    Hi @indy2005
    ,

    You are running into this issue because of the project key that you are using. This must be in uppercase and your code defines the project key as "cdata_test". Can you try putting this in capital letters and see if it helps?

    Another way to find the required project key is to list all the project keys using the code below and then select from the output list the required project key:

    dss_projects = client.list_project_keys()
    print(dss_projects)

Setup Info
    Tags
      Help me…