Preview transforms in local development

There are two main ways to preview transforms in local development with VS Code:

Preview with the Palantir extension for Visual Studio Code [Beta] (Python only)

The Palantir extension for Visual Studio Code supports local preview functionality. Refer to the extension documentation for installation instructions. Once the extension has been installed and the environment is ready for preview, your transforms should be automatically discovered in the Preview tab as shown below.

Preview functionality for a Python transforms repository in the extension for Visual Studio Code.

Running Python Transforms Preview is possible with two backends: remote and local. The former runs the previewed code inside of Foundry so that no data (except the results) get sent to the user's machine. However, when running preview in local mode, parts of the datasets are downloaded to the user's machine. For more information, consult the Transforms preview page of the VS Code extension.

Gradle-based local preview for Java

This section details the steps required to preview Python and Java transforms in local development. For additional context, review our documentation for Java local development. You can also learn more about how to preview transforms. Gradle-based local preview executes the preview remotely, inside of Foundry.

Prerequisites and limitations

Local preview support requires that the local branch must be tracking a remote branch such that the local branch needs to be pushed at least once, on top of existing prerequisites for local development. Note the following additional limitations:

  • The preview URI can only be accessed by the user who ran the preview and is available on a temporary basis.

Run dataset preview

Before running the preview, you must set up the environment for local development and ensure that your repository is upgraded to the latest template version.

  1. Run ./gradlew displayTransformsList which will return a list of all available transforms. Use datasetPreview task to list all available transforms

  2. Run ./gradlew datasetPreview --transformId=<transformId> with <transformId> replaced by one of the transform ids (blue text on the screenshot above), which will return a link to Foundry where the already-computed preview can be accessed. Use datasetPreview task to run preview and get Foundry link Precomputed dataset preview in Foundry

  3. (Optional) Add --printMode=table flag to the command above to print the first 10 rows of all previewed datasets directly in your terminal instead of being provided a link to the preview. Use datasetPreview task to run preview and print to terminal

  4. (Optional) To include input files in the preview, add --inputFiles=<datasetAlias>:<path> where <datasetAlias> is one of the input datasets from the selected transform function and <path> is the file path within the input dataset. Use input files arguments to include dataset's files

  5. (Optional) To include output files in the preview, add --outputFiles=<datasetAlias>:<path> where <datasetAlias> is one of the output datasets from the selected transform function and <path> is the file path within the output dataset. Use output files arguments to include dataset's files