Govern Uploaded Files

Users can upload files to artifacts.

Download an uploaded file

import dataikuapi

host = "http(s)://DSS_HOST:DSS_PORT"
apiKey = "Your API key secret"
client = dataikuapi.GovernClient(host, apiKey)

# retrieve a specific artifact of type govern project by its ID
artifact = client.get_artifact('ar.1773')

# get the first uploaded file stored in the related_docs field
uf = client.get_uploaded_file(artifact.get_definition().get_raw()['fields']['related_docs'][0])

# get the file description
f_desc = uf.get_description()

# retrieve the file as a stream
f_stream = uf.download()

Reference API doc

class dataikuapi.govern.uploaded_file.GovernUploadedFile(client, uploaded_file_id)

A handle to interact with an uploaded file Do not create this directly, use get_uploaded_file()

get_description()

Get the description of the uploaded file.

Returns

The description of the file as a python dict

Return type

dict

download()

Download the uploaded file

Returns

the uploaded file contents, as a stream - file-like object

Return type

a stream - file-like object

delete()

Delete the file

Returns

None