
## Create data contracts

URL: https://docs.atlan.com/product/capabilities/governance/contracts/how-tos/create-data-contracts

> Create data contracts to standardize agreements between data producers and consumers. Setup requires a YAML contract template and support for data quality rules enforcement.

# Create data contracts 

Data contracts are agreements between data producers and consumers that specify requirements for high-quality, reliable data. Add data contracts directly to supported assets in Atlan to standardize contractual obligations, organize assets with embeddable contract metadata, and enforce them with [data quality rules](https://docs.atlan.com/llms/governance/data-quality/llms.txt). You can also [create webhooks for data contracts](https://docs.atlan.com/llms/governance/integrations/create-webhooks/llms.txt) to receive notifications when a contract is added or updated.

For a data contract to help build trust in your assets, it should be:

- Templatized and easily comprehensible - use Atlan's YAML contract template to create standardized contracts and push to Atlan.
- Version-controlled - continuously validate and monitor your data contracts either in runtime or real-time.
- Embeddable - embed the contract as metadata for a supported asset.
- Enforceable - enforce your contracts with data quality rules.
- Extensible - identify new specifications, generate new versions, and then compare and contrast them.

:::info **Did you know?** 
 You can [create webhooks for data contracts](https://docs.atlan.com/llms/governance/integrations/create-webhooks/llms.txt) and receive notifications for when a contract is added or updated to a URL of your choice.

:::

## Supported asset types

You can create data contracts for the following asset types:

- Tables
- Views
- Materialized views
- [Output port assets of data products](https://docs.atlan.com/llms/catalog/data-products/what-are-data-products/llms.txt)

:::note

`IcebergTable` and `IcebergColumn` asset types are currently not supported for data contracts.

:::

## Supported asset metadata

Atlan maps the following asset metadata properties to its contract properties:

| Metadata property | Contract property |
| --- | --- |
| `name` | `dataset` |
| `typeName` | `type` |
| `userDescription` or `description` | `description` |
| `ownerUsers` | `owner.users` |
| `ownerGroups` | `owners.groups` |
| `certificateStatus` | `certification.status` |
| `certificateStatusMessage` | `certification.message` |
| `announcementType` | `announcement.type` |
| `announcementTitle` | `announcement.title` |
| `announcementMessage` | `announcement.description` |
| `meaningNames` | `terms` |
| `classificationDef.displayName` | `tags.name` |
| `classifications.propagate` | `tags.propagate` |
| `classifications.restrict_propagation_through_lineage` | `tags.restrict_propagation_through_lineage` |
| `classifications.restrict_propagation_through_hierarchy` | `tags.restrict_propagation_through_hierarchy` |
| `column.name` | `columns.name` |
| `column.userDescription` or `column.description` | `columns.description` |
| `column.dataType` | `columns.data_type` |
| `column.isPrimary` | `columns.primary` |
| `!column.isNullable` | `columns.required` |
| `column.precision` | `columns.precision` |
| `column.numericScale` | `columns.scale` |
| [tags](https://docs.atlan.com/llms/governance/tags/attach-a-tag/llms.txt) on column | `columns.tags` |
| `column.meaningNames` | `columns.terms` |
| [custom metadata](https://docs.atlan.com/llms/governance/custom-metadata/what-is-custom-metadata/llms.txt) (CM) | `custom_metadata.` |

## Add a data contract to an asset

:::warning Who can do this?
 Any non-guest user with [edit access to an asset's metadata](https://docs.atlan.com/llms/governance/access-control/what-are-purposes/llms.txt) can create, deploy, and manage data contracts. This only includes [admin and member users](https://docs.atlan.com/llms/governance/access-control/delegate-administration/llms.txt) in Atlan.

:::

To add a data contract to an asset, you can either:

- Create a contract directly in Atlan from the _Contracts_ tab of the asset profile. You can create and maintain data contracts as easily as editing a word document.
- Use Atlan CLI to import an existing contract from your local machine to Atlan directly or through a CI/CD pipeline. [Atlan CLI](https://docs.atlan.com/llms/platform/python/set-up-sdk/llms.txt) is a command-line tool that you can download directly from Atlan to your local machine to create and push data contracts to Atlan. Once you have published the contract, you can also [sync metadata](https://docs.atlan.com/llms/governance/contracts/manage-via-cli/llms.txt) from a contract to the governed asset in Atlan.

Once created, you can monitor and manage your data contracts in Atlan.

To add a data contract:

1. On the Atlan homepage, click on **all assets**.

 If you are using the **Old UI (Classic)**, from the left menu of any screen in Atlan, click **Assets**.
2. (Optional) From the _Filters_ menu on the left, click **Properties** and then click **Has contract**. Click **No** to filter for assets without a contract.
3. From the _Assets_ page, select an asset to open the asset sidebar.
4. In the left _Overview_ sidebar, click **Add contract**.
5. In the _Contract_ tab of the asset profile, you can either:
 - Click **Create contract** to create a draft contract directly in Atlan based on asset metadata.
 - Click **Import contract** to use [Atlan CLI](https://docs.atlan.com/llms/platform/python/set-up-sdk/llms.txt) to import an existing contract from your local environment to Atlan. You must first install and connect Atlan CLI and then push the contract to Atlan. Refer to the [developer documentation](https://docs.atlan.com/llms/governance/contracts/manage-via-cli/llms.txt) to complete the steps.
6. (Optional) Click the **Edit** button to edit the contract.

Congrats on adding a data contract in Atlan! 🎉

## View a data contract

To view a data contract:

1. From the left menu of any screen in Atlan, click on **all assets**.

 If you are using the **Old UI (Classic)**, from the left menu of any screen in Atlan, click **Assets**.
2. From the _Assets_ page, select an asset to open the asset sidebar.
3. From the left _Overview_ sidebar, click **View contract** to navigate to the _Contract_ tab in the asset profile.
4. (Optional) In the _Contract_ tab, you can view the contract specifications for your asset in a YAML format. You can also:
 - Click the **Document** icon to open a read-only, simplified view of your contract.
 - Next to _Published version_, click the version dropdown to view the latest version of the contract. Select an older version and then click **Compare with published version** to compare them side by side.
 - Click the **Edit** button to edit the contract.
 - Click the clipboard icon to copy the YAML code.
 - Under _Timeline_, view a timeline for the evolution of your contract.
 - Under _Summary_, view details of who last updated your contract and when.

---
