Best architecture for a metadata-driven Data Quality Engine in Foundry (500+ dynamic datasets)?

Hi everyone,

I’m trying to build a custom, metadata-driven Data Quality Engine in Palantir Foundry using Code Repositories (Python/PySpark), and I’m looking for recommendations on the best approach to implement this efficiently and at scale.

Context

I need to execute data quality checks across 500+ Foundry datasets, some of which contain millions or even billions of records.

My goal is to build a generic and scalable framework based on metadata, rather than creating and maintaining individual Transforms for each dataset.

The proposed architecture relies on two configuration datasets:

1. Dataset Registry

A dataset containing the names and RIDs of all datasets that need to be validated.

2. Data Quality Rules

A configuration dataset defining which quality rules should be executed against each dataset, for example:

  • Volumetry: Row counts and expected volume thresholds.

  • Uniqueness: Duplicate detection based on configurable columns.

  • Additional custom rules: Null checks, business validations, etc.

The engine would dynamically discover the datasets, execute their configured quality rules, and write the results into a single centralized Data Quality Results dataset.

Main challenge: Dynamic dataset access

As far as I understand, Foundry Transforms require input datasets to be explicitly declared as dependencies.

However, in my use case, the datasets to be validated are defined dynamically in the registry dataset, and I want to avoid hardcoding 500+ input dependencies.

What I’ve tried

I’ve experimented with calling Foundry APIs directly from a Python/PySpark Transform, using dataset RIDs to dynamically access and query the data.

However, I’ve encountered timeout issues when executing queries through the API.

Since some datasets contain billions of records, I’m concerned that an API-based approach may not be appropriate for running computationally expensive checks such as row counts, uniqueness validations, or aggregations.

Ideally, I’d like to leverage Foundry’s distributed Spark processing capabilities without having to statically declare every dataset as a Transform input.

Questions

  1. Dynamic dataset access: Is there a supported way to dynamically load Foundry datasets by RID within a Python/PySpark Transform, based on metadata stored in another dataset?

  2. Recommended architecture: How would you design a metadata-driven Data Quality Engine that needs to process 500+ datasets with potentially billions of records?

  3. Spark vs. APIs: Is there a recommended way to execute these quality checks using Spark rather than querying datasets through Foundry APIs?

  4. Dynamic dependencies: Are there any recommended patterns for managing a large and changing set of dataset dependencies without manually declaring each one?

  5. Scalability: Would you recommend a centralized processing engine, dynamically generated Transforms, or another orchestration pattern to handle this workload efficiently?

Expected outcome

A reusable framework where adding a new dataset or quality rule only requires updating the configuration datasets, without modifying the engine’s code or manually adding Transform dependencies.

All validation results should be consolidated into a single dataset for further analysis and reporting.

Disclaimer: I’m aware of Foundry Data Health, but it doesn’t meet my requirements. I need a custom, configurable rule engine rather than the built-in dataset health checks.

Has anyone implemented a similar architecture in Foundry? I’d really appreciate any recommendations, architectural patterns, or examples.

Thanks!

You can use the Foundry APIs to access datasets dynamically. We so something similar and it works well.

Reading through the API works, but you lose lineage, so the results dataset won’t show what it actually checked. Another way:

  • Keep the dataset registry and rules as a YAML/JSON file in the repo instead of a dataset. Then generate one check transform per dataset in a loop. Inputs have to be known at CI time, so adding a dataset means a commit, not just a row change.
  • Each generated transform writes a small results output, and you union those into your central results dataset.
  • For uniqueness and nulls, look at data expectations (E.primary_key, non_null). They can be set to WARN instead of failing the job, and they show up in Data Health.

At 500+ datasets, keep each check light, for example counts and aggregates only, so you don’t rescan billions of rows on every run.