Search code examples
palantir-foundrypalantir-foundry-api

Palantir Foundry - can we add object attachments in python transform?


We have about 20,000 PDF files uploaded to an unstructured dataset in Foundry that I would like to connect to an 'attachment' type field in an object. Is there a way to programmatically add an attachment field in a python transform dataset that would then be the backing dataset for an object? The only documentation I can find on attachment fields is to attach files manually through action forms and functions. I would like to use the attachment type in order to leverage UI features that come along with this field in action logs and Workshop. There seems to be a few API endpoints to upload attachments in Python, so we might need to build a utility to do this, but would like to know if there is a friendlier way.


Solution

  • You can use MediaSets.

    High-level steps:

    • Open your dataset of files in Pipeline Builder
    • Create a transform "GET MEDIA REFERENCES (DATASETS)". This will create a "mediaReference" column, that you can join back on any dataset backing your object.
    • Use a dataset with this "mediaReference" column to back your Object Type, and select "Media Reference" as the type of the column (see below picture)
    • Once you display the object instances in applications, the files will benefit from the same display features as Attachments.

    enter image description here