# Import/Export Rules

### Overview

The Import/Export Rules feature lets you efficiently manage Data Quality rules by importing them from Excel templates and exporting existing rules for backup, sharing, or migration.

<figure><img src="https://2027008842-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaO8uOTM2rdJeIbVeXK0c%2Fuploads%2FVi3Z4mJ0aYNdTZp3hOuP%2FScreenshot%202025-10-15%20at%202.16.48%E2%80%AFPM.png?alt=media&#x26;token=9a402c92-32fd-4a33-bc4f-e9cd8102c3c4" alt=""><figcaption></figcaption></figure>

### Accessing Import/Export Rules

To access the Import/Export Rules functionality:

1. Navigate to your **Test Cases** list
2. Locate the Data Quality test case you want to work with
3. Click on the **(N) Rules** link in the DQ Rules column (where N is the number of rules)
4. The **DQ Rules** dialog will open, displaying all rules for the selected dataset

### Export DQ Rules

<figure><img src="https://2027008842-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaO8uOTM2rdJeIbVeXK0c%2Fuploads%2FvWG0kYQNVqCW1ytAPkUR%2FScreenshot%202025-10-15%20at%202.18.13%E2%80%AFPM.png?alt=media&#x26;token=5df9cff0-d019-4f49-8743-2b674eb76445" alt=""><figcaption></figcaption></figure>

#### Overview

The Export feature allows you to download all existing Data Quality rules for a specific dataset into an Excel file. This is useful for:

* Creating backups of your rules
* Sharing rules with team members
* Migrating rules to other test cases or environments
* Using as a template for bulk rule creation

#### Steps to Export Rules

1. Open the **DQ Rules** dialog (as described above)
2. Click the **Export DQ Rules** button (cyan/teal button on the left)
3. The system will automatically generate and download an Excel file containing all your rules
4. The exported file will be named with the dataset name and timestamp

####

### Import DQ Rules

<figure><img src="https://2027008842-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaO8uOTM2rdJeIbVeXK0c%2Fuploads%2Fwj28BvphvZKvKzQlswu1%2FScreenshot%202025-10-15%20at%202.19.50%E2%80%AFPM.png?alt=media&#x26;token=421c8621-ce6f-414b-aaae-d72d5e356a7f" alt=""><figcaption></figcaption></figure>

#### Overview

There are primarily three formats to import the Data Quality Rules.

**JSON**: Once rules are exported, they can be imported into the same or different test cases. Use cases include exporting existing rules from one test case to another or migrating a single test case between environments.

**SQL**: You can connect to any database to import data. If your data matches the specified format below, rules will be populated accordingly.

**Excel**: Whether you’re using SQL or Excel, the data format needs to be consistent. Refer to the attached Excel template.

{% file src="<https://2027008842-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaO8uOTM2rdJeIbVeXK0c%2Fuploads%2FHQbjIdDgoBFh8MfL7jn6%2Ftemplate.xlsx?alt=media&token=aa0e150c-ad63-4d86-973a-53d8f575ac5e>" %}

#### Prerequisites

Before importing rules, ensure you have:

1. A valid Excel template file (download the template from this documentation page)
2. All required columns filled in the template
3. Valid SQL syntax for SQL-based rules
4. Correct column names that match your target dataset

#### Steps to Import Rules

1. Open the **DQ Rules** dialog for your target dataset
2. Click the **Import DQ Rules** button (white/outlined button)
3. A file browser dialog will open
4. Select your prepared Excel file (.xlsx format)
5. Click **Open** to upload the file
6. The system will process and validate the rules
7. Successfully imported rules will appear in the rules list immediately

## Excel/SQL Template Structure :

**Test Case Structure Guide**

* **TEST\_CASE\_ID**\
  Unique identifier for each test case.\
  \&#xNAN;*Format*: TC-XXX (e.g., TC-101, TC-102)
* **TEST\_CASE\_NAME**\
  Clear description of the validation objective, explaining the business or technical rule.
* **SQL\_EXECUTE\_COLUMN\_DQ**\
  SQL query utilizing INFORMATION\_SCHEMA tables that outputs a single value or count. No placeholders are present.
* **SQL\_EXECUTE\_COLUMN\_DQ\_EXPECTED\_RESULT**\
  \&#xNAN;*Format for Expected Result*:
  * For COUNTS\_VALIDATION: Use =0, >10, <100
  * For DATA\_VALIDATION: Use =VALUE, >30, <1000
* **TEST\_CASE\_SEVERITY**
  * *Warning*: Non-critical, informational
  * *Severe*: Critical, requires immediate action
* **DQ\_SQL\_TYPE**
  * *COUNTS\_VALIDATION*: Returns count of records.

#### Rule Types Supported

Currently only SQL rules can be imported in SQL and Excel:

1. **SQL Rules**: Custom SQL queries that return validation results
2. &#x20;  \- Must return a numeric value or boolean result
3. &#x20;  \- Can include complex queries with joins, aggregations, and window functions
4. **Column Level Rules**: Validation rules applied to specific columns
5. &#x20;  \- Specify the target column name
6. &#x20;  \- Define validation criteria
