# Additional settings

## Test a contract on a sample

{% hint style="warning" %}
Currently, **this feature is only supported in Snowflake data sources**.
{% endhint %}

When testing a data contract, Soda allows you to **run contract validation on a sample of your dataset** instead of the full data. This feature helps you quickly and cost-efficiently verify that your contract runs correctly before executing full scans.

Running a test contract on a sample enables you to:

* Validate that your contract **syntax**, **checks**, and **filters** work as expected.
* **Reduce data warehouse compute cost** while verifying new or updated contracts.
* **Iterate faster** on contract definitions in development environments.

Results from sampled runs reflect only a subset of your data and **may not represent its actual quality**. Use full verification once your contract logic is validated.

### Enable sampling for test contracts <a href="#fe3e56b4-c951-4d56-9b18-e7e4a92ce408" id="fe3e56b4-c951-4d56-9b18-e7e4a92ce408"></a>

This feature can be enabled at the **data source level**, applying to **all datasets** that use that connection.

{% hint style="warning" %}
You need the "**Manage data sources**" global permission to add a new data source. Learn more about [Global and Dataset Roles](https://docs.soda.io/organization-and-admin-settings/global-and-dataset-roles).
{% endhint %}

To enable this feature:

1. Go to **Data sources**.
2. Click **Edit connection** for a data source.

<figure><img src="https://1123167021-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA2PmHkO5cBgeRPdiPPOG%2Fuploads%2FURoxSsfsC9TDB9mJH65D%2Fimage.png?alt=media&#x26;token=08eb4560-8ba1-4095-8851-c2f21e466a82" alt=""><figcaption></figcaption></figure>

3. Under the **Connection Details** section, toggle **Data Sampling**.
4. Specify your **sample size** on the **Limit** field.

<figure><img src="https://1123167021-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA2PmHkO5cBgeRPdiPPOG%2Fuploads%2Fey6zFYu73Ys12Ut6ivUO%2Fimage.png?alt=media&#x26;token=387f86dc-c019-4187-8fac-de12fa0ddef2" alt="" width="375"><figcaption></figcaption></figure>

5. <i class="fa-octagon-check">:octagon-check:</i> Click **Connect**.

***

## Optimize computing with multiple warehouses <a href="#id-007f192a-6572-4ab6-ada0-b47802ea6499" id="id-007f192a-6572-4ab6-ada0-b47802ea6499"></a>

{% hint style="warning" %}
Currently available in **preview**. This feature is **only supported in Snowflake data sources**.
{% endhint %}

When connecting to Snowflake, you must provide a **warehouse** as part of the data source configuration. By default, this single warehouse is used for **all operations**, including discovery, metric monitoring, profiling, data contract executions, and the diagnostics warehouse.

The **Configure warehouses per dataset** feature gives you greater control and flexibility by allowing you to **define specific warehouses for individual datasets**. This helps you **optimize cost, manage compute workloads, and allocate resources efficiently** across your data operations.

{% hint style="info" %}
This feature is available **only when using Soda Agent**. When using **Soda Core**, the warehouse can be specified directly in the **connection YAML** instead.
{% endhint %}

### Enable the use of multiple warehouses <a href="#id-0424e569-b9e6-4d55-975c-659278f8ff7a" id="id-0424e569-b9e6-4d55-975c-659278f8ff7a"></a>

{% hint style="warning" %}
You need the **“Manage data sources”** global permission to enable or modify this feature. Learn more about [global-and-dataset-roles](https://docs.soda.io/organization-and-admin-settings/global-and-dataset-roles "mention").
{% endhint %}

1. Go to **Data sources** in Soda Cloud.
2. Click **Edit connection** for your **Snowflake** data source.

   <figure><img src="https://uploads.linear.app/d00a6cd4-ffd1-4741-b9dd-d189dbe9db85/3a7b82a7-9600-409e-87ac-b1a713ede4ae/b33ba1bf-9aa8-471b-a60c-018445033b56?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiL2QwMGE2Y2Q0LWZmZDEtNDc0MS1iOWRkLWQxODlkYmU5ZGI4NS8zYTdiODJhNy05NjAwLTQwOWUtODdhYy1iMWE3MTNlZGU0YWUvYjMzYmExYmYtOWFhOC00NzFiLWE2MGMtMDE4NDQ1MDMzYjU2IiwiaWF0IjoxNzYyNDM5NDIzLCJleHAiOjMzMzMyOTk5NDIzfQ.MH1EMdvayrGXZ0o4_EC2STMARY11h8EjHZjsb57dmsE" alt=""><figcaption></figcaption></figure>
3. Toggle on **Configure Warehouses**.
4. Specify the **list of allowed warehouses** that can be used by this connection.
5. Choose a **default warehouse** to use for all datasets unless otherwise specified.

   <figure><img src="https://1123167021-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA2PmHkO5cBgeRPdiPPOG%2Fuploads%2Fp2RYHlKEP9wsRktBBLKC%2Fimage.png?alt=media&#x26;token=37ee1986-77ea-4705-b305-f6cebcafa1e2" alt="" width="375"><figcaption></figcaption></figure>
6. <i class="fa-octagon-check">:octagon-check:</i> Click **Save** on the top right to save your configuration.

### Default warehouse behavior <a href="#id-185aa99d-863f-4d78-b1a3-8b706756355e" id="id-185aa99d-863f-4d78-b1a3-8b706756355e"></a>

Once enabled:

* The **warehouse** specified in the data source connection is used for **discovery**.
* The **default warehouse** (defined under **Configure Warehouses**) is used for:
  * Metric monitoring
  * Profiling
  * Data contract executions
  * Diagnostics Warehouse operations
* A different warehouse can be configured at the **dataset level**, overriding the default.

### Specify a warehouse at the dataset level <a href="#id-5539aebb-d45a-40cf-8911-85d9f3c848ff" id="id-5539aebb-d45a-40cf-8911-85d9f3c848ff"></a>

{% hint style="warning" %}
You need the **“Configure dataset”** permission to edit dataset-level configurations. Learn more about [global-and-dataset-roles](https://docs.soda.io/organization-and-admin-settings/global-and-dataset-roles "mention").
{% endhint %}

1. Go to a dataset in Soda Cloud.
2. Click **Edit dataset**.

<figure><img src="https://uploads.linear.app/d00a6cd4-ffd1-4741-b9dd-d189dbe9db85/ed0d7687-7819-4b93-97fb-ef15f13e3a35/f5faf6ef-23ad-496d-8f5c-981b3e9a770a?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiL2QwMGE2Y2Q0LWZmZDEtNDc0MS1iOWRkLWQxODlkYmU5ZGI4NS9lZDBkNzY4Ny03ODE5LTRiOTMtOTdmYi1lZjE1ZjEzZTNhMzUvZjVmYWY2ZWYtMjNhZC00OTZkLThmNWMtOTgxYjNlOWE3NzBhIiwiaWF0IjoxNzYyNDQwMTY1LCJleHAiOjMzMzMzMDAwMTY1fQ.d_zLQEcAf8x3fGxSLAdMoN0QLilDl7rENKBpvsaZbYY" alt=""><figcaption></figcaption></figure>

3. Under the **Snowflake** section, select the **warehouse** to use for this dataset.

   <figure><img src="https://uploads.linear.app/d00a6cd4-ffd1-4741-b9dd-d189dbe9db85/38691234-d3a1-4a59-8221-e1f39150c427/2f901a7b-128d-4ef4-a111-cf65cf08c461?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiL2QwMGE2Y2Q0LWZmZDEtNDc0MS1iOWRkLWQxODlkYmU5ZGI4NS8zODY5MTIzNC1kM2ExLTRhNTktODIyMS1lMWYzOTE1MGM0MjcvMmY5MDFhN2ItMTI4ZC00ZWY0LWExMTEtY2Y2NWNmMDhjNDYxIiwiaWF0IjoxNzYyNTA1ODY1LCJleHAiOjMzMzMzMDY1ODY1fQ.In-hdPhuI018HX_hEkAPmQ4U7GME9avZqenScBZMxRA" alt=""><figcaption></figcaption></figure>
