Palantir has made Ontology SQL and SQL functions generally available on all Foundry enrollments. Builders can now publish Ontology checks as reusable functions.

The entry in Palantir's November documentation announcements is dated November 12. It says: "The Ontology SQL capability allows you to query the Ontology through a subset of the Spark SQL dialect. This feature is now generally available on all enrollments as of the week of 9 November."

Two newer entries on the same page fit the same workflow. On November 17, Palantir announced a Compare tab in Dataset Preview. On Thursday, it made Foundry usage and limits generally available in Resource Management. This piece shows how to use them together.

What you are working with

Palantir describes the engine this way: "Ontology SQL is Foundry's SQL engine for querying Ontology object types, interfaces and many-to-many links. Queries execute directly against object storage using an in-memory compute path for fast response times on supported query shapes, with more complex queries automatically routed to Spark."

SQL functions make those queries reusable. Palantir says: "Ontology SQL functions are parameterized SQL queries over the Ontology that you can publish as Foundry functions. Use them across the platform, including in Workshop, Actions, Automate, and the Ontology SDK."

You write queries in SQL Studio, which Palantir describes as Foundry's dedicated application for writing and running SQL queries. The November entry adds: "Publish your query as a SQL function, and manage it from Ontology Manager."

Palantir's May announcements described SQL Studio as offering read support for ontology object types. We think that suits checks well, because a check should inspect objects and leave them unchanged.

The pattern, step by step

The pattern assumes you make the Ontology change on a global branch. Palantir lists the Ontology among the applications Global Branching supports.

  1. Write your checks in SQL Studio. Pick facts that must stay true after your change. We suggest queries that return a number you can predict, often zero. Examples include a count of objects for a type, a count with an empty required property, or a count across a many-to-many link.
  2. Parameterize them. Replace hard-coded values, such as a status or a date cut-off, with parameters. One function can then cover several cases.
  3. Publish each check as a SQL function. Palantir says you can "Explore your function across its published versions in Ontology Manager." That gives each check a version history.
  4. Record a baseline. Run your functions on Main before you touch anything, and note the results.
  5. Make your Ontology change on a global branch.
  6. If the change involves dataset or transform edits, compare the data before merging. Use the new Compare tab, covered below.
  7. Test any application code separately. If your work also includes an OSDK React application or functions, you can run that code locally against live objects and links with SuperRepo's remote preview, also covered below. This is a local code test, not a test of your branched Ontology change.
  8. Open a proposal and merge it.
  9. Re-run your SQL functions after the merge. Compare the results with your baseline. In our view, any difference you did not plan for is your regression signal.
  10. Make it a habit. Palantir says SQL functions can be used in Automate and Workshop. We think that makes it simple to turn one-off checks into a standing monitor or a team dashboard.

Comparing data before you merge

The November 17 entry describes the Compare tab in Dataset Preview: "Compare versions of the same dataset or table across history and branches, or compare different datasets and tables to understand how their contents differ. Investigate unexpected changes between builds, validate transformation changes before merging, or check the results of a pipeline migration."

Palantir says you can "See how many records were added, removed, or modified, and inspect before-and-after values." The tab works on datasets and tables.

We think the Compare tab and SQL functions fit together well. Compare shows how the underlying data shifted on the branch. Your SQL checks confirm the objects still behave as expected.

Testing code locally with remote preview

Palantir's November 10 entry says: "You can now use REMOTE_ONLY mode in SuperRepo preview to run your OSDK React application and functions locally against live objects and links in the Ontology. Access is read-only and uses your own permissions."

  1. Update the CLI. Palantir says to update the Foundry CLI to version 0.351.0 or later with `foundry update self`.
  2. Switch your SuperRepo preview to REMOTE_ONLY mode.
  3. Run your preview. Palantir says: "SuperRepo makes requests using standard Foundry project and role-based permissions, so remote preview returns only the objects you can access."

Where SQL fits

Palantir's August announcements said window functions such as RANK() and LAG() take considerable code in TypeScript but a single statement in SQL.

In our view, SQL is the right tool for read-and-assert work. That covers counts, filters, joins across links, rankings and aggregates with a predictable answer.

Limits and usage

In SQL Studio, Palantir said in May, previews default to 1,000 rows, and users with the appropriate permissions can return up to 10,000. In our view, checks that return a count rather than a full table sit comfortably inside that.

The November 19 entry says: "Foundry usage and limits are now generally available in Resource Management for all enrollments." You can "Choose a service from the list of services with an enrollment-level quota configured for your environment, such as Ontology reads, platform APIs, or function compute."

Palantir says the page covers only traffic reported through Foundry's rate limits infrastructure, and that it does not represent all compute, storage or billable usage. For those, Palantir says to keep using the Overview and Analysis pages in Resource Management.

Watch out for

  • Branch uploads and action edits stay on the branch. In its November entry on uploads, Palantir says: "Uploads and other action edits made on a branch are intended for testing and are not merged into main." Do not expect those test uploads or action edits in your after-merge results.
  • Schema mismatches block remote preview. Palantir says: "If the schemas differ, remote preview reports a Foundry schema mismatch error and serves no data until they match."
  • Remote preview reflects your permissions. An object that seems to be missing may be one you cannot access.
  • The Compare tab arrives gradually. Palantir says: "This feature will roll out to users incrementally over the next few weeks."
  • The usage page is view-only. Palantir says: "The Foundry usage & limits page is read-only: you cannot configure or change rate limits from it." Viewing it requires the Resource management viewer role at the enrollment level.

What to watch

Palantir says: "Ontology SQL is under active development." Its near-term goals are better support for Spark SQL functions, execution optimizations to reduce query latency, and better observability on planning and execution.

In our view, each of those makes SQL checks more expressive, quicker and easier to debug. We think published SQL functions, run around every Ontology change and paired with the Compare tab, are the closest thing yet to a test suite for the Ontology.