Getting the project name of the project that imported a code library

info-rchitect
info-rchitect Registered Posts: 180 ✭✭✭✭✭✭

Hello,

I have a shared code library that others use by editing their `external-libraries.json` file. Is there a way for that code library to fetch the project that has imported it?

thx


Operating system used: Windows 10

Tagged:

Best Answer

  • Jean-Yves
    Jean-Yves Dataiker Posts: 14 Dataiker
    edited July 17 Answer ✓

    Hello,

    Thank you for your question! You could leverage our python api and retrieve the project key where the library is being run:

    import dataiku 
    current_project_key = dataiku.default_project_key()


    If you want the name of the project (not its identifier - the key) , you can run the following:

    import dataiku
    
    client = dataiku.api_client()
    project = client.get_default_project()
    current_project_name = project.get_metadata().get('label')


    I hope this helps!

    Jean-Yves

Setup Info
    Tags
      Help me…