How to get metadata from managed folder of dataiku?

vebo
vebo Registered Posts: 1
edited January 8 in Using Dataiku

I am trying to get the last modification from the metadata of managed folder of dataiku but it is throwing below error

Exception: None: b"Failed to convert value of type 'java.lang.String' to required type 'boolean'; nested exception is java.lang.IllegalArgumentException: Invalid boolean value [/GSX Daily Pos.xlsx], caused by: IllegalArgumentException: Invalid boolean value [/GSX Daily Pos.xlsx]"

folder = dataiku.Folder("Test_folder")

for file_path in folder.list_paths_in_partition():
file_info=folder.get_info(file_path)
last_modified=file_info.get("lastModified",None)

Here error is in folder.get_info(file_path)

Operating system used: Windows

Operating system used: Windows

Tagged:

Answers

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,181 Neuron
    edited January 8

    Please use code block to post sample code. Here is the code to get files from a folder:

    import dataiku
    import datetime
    
    client_handle = dataiku.api_client()
    project_handle = client_handle.get_project('project_key')
    managed_folder = project_handle.get_managed_folder('some_folder')
    folder_contents = managed_folder.list_contents()
    
    for folder_item in folder_contents['items']:
        print(folder_item['path'] + ' - ' + datetime.datetime.utcfromtimestamp(int(folder_item['lastModified']) / 1000).strftime("%d-%b-%Y %H:%M:%S"))
    

Setup Info
    Tags
      Help me…