# ❖ ReferenceTable

{% hint style="info" %}
❖ **SDV Enterprise Bundle**. This feature is available as part of the **CAG Bundle**, an optional add-on to SDV Enterprise. For more information, please visit the [CAG Bundle](/sdv/explore/sdv-bundles/cag.md) page.
{% endhint %}

Use the **ReferenceTable** constraint when you have a table that acts as an unchangeable reference. That is to say, you do not want to synthesize an new information in it; the table's contents should always remain as-is.

When you apply this constraint, the reference table's contents remains as-is. At the same time, synthetic data is generated for all other tables, including ones that link to the reference table.

<figure><img src="/files/66uiA9BGMDKIZcFAw84E" alt=""><figcaption><p>In this example, the <code>City</code> table is a reference table. You do not want to synthesize new cities, but you do want to synthesize other tables that link to the cities such as <code>Supplier</code>, <code>Product</code>, etc.</p></figcaption></figure>

## Constraint API

Create a `ReferenceTable` constraint

**Parameters**:&#x20;

* (required) `reference_table_names`: A list of strings representing all the reference tables that are in your schema.&#x20;

```python
from sdv.cag import ReferenceTable

my_constraint = ReferenceTable(
    reference_table_names=['City'])
```

Make sure that all table names you provide are in your [Metadata](/sdv/concepts/metadata.md). Reference tables are not allowed to have any foreign key references to non-reference tables.

## Usage

Apply the constraint to any SDV synthesizer. Then fit and sample as usual.

```python
synthesizer = HSASynthesizer(metadata)
synthesizer.add_constraints([my_constraint])

synthesizer.fit(data)
synthetic_data = synthesizer.sample()
```

For more information about using predefined constraints, please see the [**Constraint-Augmented Generation tutorial**](https://colab.research.google.com/drive/1WCMQujfVKL5giULZXOPPIBoMfzR9Zj68?usp=sharing).

## Auto-Detection

Auto-detection not available for this constraint. Please create the constraint object and add it to the synthesizer using the API described above.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sdv.dev/sdv/concepts/constraint-augmented-generation-cag/predefined-constraints/referencetable.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
