---
title: "CAT in Databricks notebooks"
description: "Running CAT tests from a Databricks notebook with the Python module — when it makes sense, and how to set the cluster up."
url: "https://docs.justcat.it/how-to-guides/data-platforms/cat-in-databricks-notebooks/"
---
# CAT in Databricks notebooks


## Testing Databricks data — from where?

CAT tests data in Databricks Delta tables through the `Odbc@1` provider and the Simba driver; it can even generate metadata-driven tests from Unity Catalog. The setup is in [Test Databricks](https://docs.justcat.it/how-to-guides/data-platforms/test-databricks/ "Test Databricks").

> **😺:** We recommend running the tests **outside the Databricks notebooks** — from a development machine, a build agent or any other machine in your architecture where it makes sense.



The reason is what CAT is for: checking that the data is correct end to end, which means cross-system comparisons — sources against the lakehouse, the lakehouse against Power BI, incremental loads against their sources. Tests of that kind (data readiness in the sources, incremental-load correctness, every Power BI test, every cross-system check) belong to a place that can see all the systems; a notebook inside one of them is a witness with a limited view. Run CAT from somewhere else. Really.

## But I want to run tests from a notebook

It is possible. The notebook needs two things: the `justcatit` package and a .NET runtime on the cluster nodes.

**Library.** In the cluster's *Libraries* settings, install the PyPI package **justcatit** (<https://pypi.org/project/justcatit/>).

**.NET runtime.** Create `InitCluster.sh` in your workspace or repository (or add the lines to an existing cluster init script). It installs the .NET 10 runtime with Microsoft's install script, which works on every Ubuntu release Databricks runs — the `apt` packages do not (Microsoft's package feed has no .NET 10 for Ubuntu, and Ubuntu's own feed has it only from 24.04):

```bash
#!/bin/bash
echo 'Installation of .NET 10 runtime start.'
curl -sSL https://dot.net/v1/dotnet-install.sh -o /tmp/dotnet-install.sh
sudo bash /tmp/dotnet-install.sh --runtime dotnet --channel 10.0 --install-dir /usr/share/dotnet
sudo ln -sf /usr/share/dotnet/dotnet /usr/bin/dotnet
echo 'Installation of .NET 10 runtime end.'
```

Then edit the cluster, open *Advanced options* and add the init script (type *Workspace*).

**Use CAT.** Put a `.cat.yaml` project file in your workspace and run it from the notebook:

```python
from justcatit import cat
summary = cat.invoke_project("/Workspace/Users/you/tests/Dwh.cat.yaml")
print(summary.GetShortSummary())
```

## What is different on a cluster

The cluster nodes run Linux, and the Python module is built and tested on Windows — see [Platforms](https://docs.justcat.it/reference/python-module/introduction/#platforms "Platforms"). In short: the providers built on Windows components (`Dax@*`, `PowerBI@*`, `CsvOleDB@1`, `ExcelOleDB@1`) are unavailable; the DuckDB-based `Csv@2` / `Excel@2` providers lack their Linux native library in the package; the `xlsx` output fails after the tests ran — use `json`, `yaml`, `junit` or a database output, or `skip_outputs=True`; log files land in `./CAT/Logs/` under the working directory. A cluster is also an automated environment: the **Team** plan, which is interactive-only, may be refused there — use the Enterprise plan with a license key set through `cat.set_instance(...)`. The failed-test signal is the summary, as everywhere: `summary.FailedCount`.

## Related

- [Python module — Introduction](https://docs.justcat.it/reference/python-module/introduction/ "Python module") · [`invoke_project`](https://docs.justcat.it/reference/python-module/invoke-project/ "invoke_project").
- [Test Databricks](https://docs.justcat.it/how-to-guides/data-platforms/test-databricks/ "Test Databricks") — driver, ODBC entry, first test.
- [CAT and Microsoft Fabric](https://docs.justcat.it/how-to-guides/data-platforms/test-microsoft-fabric/ "CAT and Microsoft Fabric").

