Skip to main content

Transforms package

A package for transforming data using transform syntax similar to Palantir Foundry. It enables you to write and test transforms locally before running them on foundry. Also they can be run faster using duckdb as underlying data engine.

Getting Started

Installation

Install the package using pip:

pip install foundry-duck-transforms

Basic Usage

  1. Create a transform file (e.g. my_transform.py)
  2. Run it using the transforms CLI:
python -m transforms.run my_transform.py dev,master

Above command will run the transform while downloading data from dev, fallbacking to master if dataset has no data on dev.

CLI Options

The transforms runner supports several options to customize execution:

python -m transforms.run [OPTIONS] TRANSFORM_TO_RUN FALLBACK_BRANCHES

Available options:

  • --engine [spark|duckdb|spark-sail]: Engine to use for the transformation (default: spark)
  • --omit-checks: Disables checks running
  • --sail-server-url TEXT: Sail server url (required when using spark-sail engine)
  • --dry-run: Dry run the transformation without writing results
  • --explain: Print DuckDB SQL and EXPLAIN plan instead of executing the transform (requires --engine duckdb)
  • --verbose: Enable verbose timing diagnostics for startup and dataset loading
  • --ui [plain|progress]: Output mode — plain logs (default) or Rich progress bars showing per-dataset startup status
  • --local-dev-branch-name TEXT: Branch name for local development (default: "duck-fndry-dev")

Example with options:

python -m transforms.run my_transform.py dev,master --engine duckdb --dry-run

To inspect the DuckDB query plan without writing output or materializing data:

python -m transforms.run my_transform.py dev,master --engine duckdb --explain

For multi-input transforms, use progress mode to see which datasets are still loading:

python -m transforms.run my_transform.py dev,master --ui progress

Combine with --verbose to show sub-phase detail (identity resolution, file fetch, parquet read) in each progress bar:

python -m transforms.run my_transform.py dev,master --ui progress --verbose

Development Setup

Prerequisites

  • Python 3.7+
  • pip
  • Access to Palantir Foundry environment

Local Development

  1. Clone the repository
  2. Install development dependencies:
pip install -e ".[dev]"

Foundry Dev Tools Configuration

See here for detailed configuration instructions.

Duck Transforms Settings

Create config_foundry_duck_transforms.toml in the same locations as foundry-dev-tools config:

  • ~/.foundry-dev-tools/config_foundry_duck_transforms.toml
  • ~/.config/foundry-dev-tools/config_foundry_duck_transforms.toml
  • {project_root}/config_foundry_duck_transforms.toml

Example:

[config]
allowed_stale_time = "7d"

[datasets."ri.foundry.main.dataset.33dd1b10-cbcb-4035-94a4-a5e9d26699ce"]
allowed_stale_time = "30d"
source_query = "SELECT col_a, col_b FROM `{dataset_rid}` WHERE event_date >= '2025-01-01'"

Options:

  • allowed_stale_time — keep using the on-disk Foundry cache even when a newer transaction exists, as long as the cached transaction closeTime is within this TTL (90m, 24h, 7d, etc.). Omit for always-fresh downloads.
  • source_query — Foundry SQL used instead of a full file download. Placeholders: {dataset_rid}, {dataset_path}, {branch}. Query results are cached locally under the foundry-dev-tools cache directory; cache TTL uses the same allowed_stale_time.

Per-dataset [datasets."..."] tables override global [config] defaults. Dataset keys can be a dataset RID or Foundry compass path.

VSCode Setup

Add this to your .vscode/launch.json for debugging support:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Python Debugger: Current File",
      "type": "debugpy",
      "request": "launch",
      "module": "transforms.run",
      "args": ["${file}", "dev,master"],
      "console": "integratedTerminal"
    }
  ]
}

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for foundry-duck-transforms 0.1.22

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for foundry-duck-transforms 0.1.22
File Size Uploaded Provenance Actions
foundry_duck_transforms-0.1.22.tar.gz 104.1 kB Without provenance Details for foundry_duck_transforms-0.1.22.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for foundry-duck-transforms 0.1.22
File Interpreter ABI Platform Actions
foundry_duck_transforms-0.1.22-py3-none-any.whl Python 3 none any Details for foundry_duck_transforms-0.1.22-py3-none-any.whl

Total release size: 170.7 kB

Release files / foundry_duck_transforms-0.1.22.tar.gz

Download URL foundry_duck_transforms-0.1.22.tar.gz
Size 104.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b5b542fb244178591b410aec33dc271ea163981f57c52da9c5f5369e5bcc4869
BLAKE2b-256 checksum
How to use checksums
07549bd4e2fa0635e2fab51bef45322198c8410a439fd2ea066af971ec7302fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / foundry_duck_transforms-0.1.22-py3-none-any.whl

Download URL foundry_duck_transforms-0.1.22-py3-none-any.whl
Size 66.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f1ac4ddded9def75711e637000a36b381d9a7b7a97f2c4ba4209e3123e36126
BLAKE2b-256 checksum
How to use checksums
49126fe9633df4a2317cd276db5388e7bba85778f448a441e433ec29e1c045d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Security for foundry-duck-transforms 0.1.22

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page