Data expectations let a Foundry build abort itself when its data breaks a rule written in code, Palantir's documentation says. In our view, that makes them the most upstream of the three gates in our series.
This guide completes our quality-gate series. Earlier guides covered guarding Ontology action types with submission criteria and using Ontology SQL functions as regression checks. We also covered checking AIP web search citations. Those gates work at action submission and in the Ontology. This one works in the build.
Why this matters now
Palantir has widened where these checks apply during 2026. In March it added health checks for virtual and Iceberg tables. In October it brought expectation checks to Iceberg outputs in Pipeline Builder.
In our view, the toolkit now covers enough of a typical pipeline that a gate at the build stage is worth adding.
What data expectations are
Palantir's guide opens with a definition: "Data expectations are a set of requirements defined in code on dataset, virtual table, and Iceberg table inputs or outputs." It adds: "If a Data Expectation check fails as part of a dataset build, the build can be automatically aborted in order to save time and resources, and avoid issues in downstream data."
The same page defines the vocabulary:
- Expectation: "A strongly typed requirement on the data structure or content (e.g. column is not null)"
- Check: an expectation, or a composite of several, connected to a single input or output dataset in a transform.
- Pre-condition: a check on a transform input, used "typically to validate essential assumptions on the inputs structure or content before proceeding with the build".
- Post-condition: a check on the output, used "typically to guarantee dataset SLAs are maintained and downstream dependencies are protected".
Expectations run inside the build. Palantir says that means you can "prevent downstream failures and bad data from propagating to downstream resources". They also live in Code Repositories. Palantir says "changing them will require the same pull-request review process that is set on your protected branches".
Before you start: you need a Python transforms Code Repository with the `transforms-expectations` library. Palantir's getting-started page says the library "should already be installed".
Set up your first checks
- Confirm the library. Open the library search panel on the left side of your Code Repository and look for `transforms-expectations`.
- Import what you need. The getting-started page gives these two lines:
```python
from transforms.api import transform_df, Input, Output, Check
from transforms import expectations as E
``` - Pick your expectations. The expectations reference covers the four basics:
- Primary key: these expectations "take one or more column names and verify: Each column has no null values. The combination of columns is unique".
- Nulls: `E.col('c').non_null()` checks that a column value is not null.
- Row counts: `E.group_by().count().lt(100)` checks that the dataset has fewer than 100 rows. `E.count().equals(0)` is the shorthand for an empty group-by.
- Schema: `E.col('c').exists()` checks that the column exists in the output dataframe. `E.col('age').has_type(...)` checks its type.
- Wrap each expectation in a named check with a failure mode. Palantir's example is `Check(E.primary_key('id'), 'Primary Key', on_error='FAIL')`.
- Attach it as a pre-condition or post-condition on the relevant input or output of your transform.
For type checks, the getting-started page says to use Polars types for single-node compute, whatever the engine. It says to use Spark SQL types for PySpark compute.
Fail the build, or only warn
Each check sets its own behaviour. The getting-started page lists two modes:
- `FAIL` (the default): "Job will be aborted if check fails"
- `WARN`: "Job will continue and a warning will be generated and handled by Data Health"
When a FAIL check trips, the main guide says "the job status will change to “Aborted” with an appropriate error". Failures show in the Builds application and the dataset History tab. The Job timeline gets an "Expectations" indicator that opens the check results and a breakdown of each expectation.
We think FAIL belongs on your most critical outputs, where a broken primary key is worth stopping the build for. In our view, WARN suits signals you want to watch, such as a row count drifting lower.
Know which build a pre-condition stops
In our view, this rule is easy to miss. Palantir says: "When a pre-condition fails the output of the transform will be aborted (rather than the input on which the pre-condition was defined)."
To stop the input dataset itself from building, Palantir says the expectation "must be defined as a post-condition on the input dataset transform". We think the cleanest pattern is a post-condition on each dataset you own. Keep pre-conditions for data you consume but do not control.
Work on branches first
Palantir says "The check is registered during CI on the relevant branch." Changing expectations on protected branches needs a pull request, like any other code change.
Palantir recommends that you "build the dataset on the development branch to ensure your Data Expectations are met before merging changes to the default branch". It calls this proactive testing.
We think the redesigned Compare tab in Dataset Preview is a useful companion here. Palantir's November announcements say it brings primary-key-based comparisons to Foundry datasets and Iceberg tables. Palantir says you can use it to "validate transformation changes before merging".
Route the alerts to someone
Palantir says "Each check run produces a result that is reported to Data Health." The latest results appear in the Dataset Preview Health tab, "where notifications and issue triggers can be set".
The health checks overview says: "When problems are detected, you will receive in-platform notifications and emails alerting you to the issue." The observability overview adds: "Alerts can be delivered through Foundry notifications or through external systems such as PagerDuty or Slack."
Palantir's recommended checks page lists platform health checks to pair with expectations. Two stand out:
- Schedule status check: Palantir says it "will catch all failures in a pipeline".
- Schema check: Palantir advises one "if pipeline outputs are consumed by users in other applications, such as Contour, Slate or Object Explorer".
Only one check of a given type can exist on a dataset. If the check you want already exists, the page says to "just subscribe to it".
Beyond Code Repositories
The March 2026 announcement brought health checks to virtual tables and to managed and virtual Iceberg tables. They include "Ensuring primary key values are 100 percent unique and non-null", along with schema, freshness and column checks. Palantir says the feature also covers virtual tables sourced from Databricks, Snowflake and BigQuery. To set one up, select Add checks from the table's Health tab.
For Iceberg outputs in Pipeline Builder, the October announcement describes "checks that can fail the build before publishing invalid results".
Watch out for
- Renaming checks. "Changing the name of a check is equivalent to removing the old check and creating a new one in its place." The check's history and monitoring settings go with the old name.
- Duplicate names. "The check name must be unique in a single transform."
- Incremental outputs. "All checks run on full datasets, regardless of the incremental nature of the transform." A primary-key check fails if a new transaction repeats a key written earlier.
- Composite checks. Palantir says a check "is monitored as a whole". It recommends splitting a composite check if you want notifications on specific parts.
- Virtual table outputs. "Setting on_error='FAIL' is not supported for virtual table outputs in single-node transforms."
- Noisy checks. In our view, the fastest way to lose a gate is an alert nobody reads. Split composite checks so each alert names one problem, and keep FAIL for rules that should stop the build.
What to watch
In our view, the series now gives teams checks at three different points:
- Expectations can abort or warn on a build.
- Ontology SQL functions can serve as regression checks.
- Submission criteria guard action submissions.
October's Iceberg-output checks brought expectation-style checks into Pipeline Builder. We will watch for that support to extend further.
